Use phpmailer to implement simple openvpn user authentication. code _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Use phpmailer to implement simple openvpn user authentication. Now everyone has countless accounts and passwords, which cannot be remembered. The principle is to complete authentication through the mail server pop service, or use SMTP and add SSL to improve security; password setting is not required. now everyone has countless accounts and passwords, which is hard to remember. The principle is that authentication is completed through the pop service of the mail server. you can also use SMTP and add SSL to improve security; this eliminates the trouble of setting User/Password. it is suitable for scenarios where you have your own email server and require PHPMailer. google
PHP code

The code is as follows:


Require_once ('class. phpmailer. php ');
Require_once ('class. pop3.php ');
$ Username = getenv ('Username ');
$ Password = getenv ('password ');
$ Pop = new POP3 ();
$ Auth = $ pop-> Authorise ('your .mailserver.com ', 110, 30, "$ username", "$ password", 1 );
If ($ auth ){
# Echo OK;
Exit (0 );
} Else {
# Echo "FAIL ";
Exit (255 );
}
?>



Save as auth_user.php and set it to executable
Server. conf directly
Auth-user-pass-verify auth_user.php via-env

Authentication, it is hard to remember; the principle is to complete authentication through the mail server pop service, you can also use SMTP, and add SSL to improve security; do not set user/password...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.