How to add and subtract online in PHP. Users in HTPASSWD

Source: Internet
Author: User
How to add and subtract online in PHP. Users in HTPASSWD

Include ("./class. Htpasswd.php3 ");

/* Please modify this. htpasswd file path
*/
$htpasswdfile = "/USR2/AMITC/.HTPASSWD";


Do not modify this line
Echo '
if (!isset ($operation)) {
}
else {
echo "";
echo "You have just done this, please check
";
echo "You want to do the user $username and password $password = [$doop]
";
$handle = new htpasswd ($htpasswdfile);

Switch ($doop) {
Case ' Add ':
PRint "User
";
$retval = $handle->adduser ($username, $password);
if ($retval) {
print "User [$username] Join success!
";
} else {
print "Join user [$username] failed.
";
}
Break

Case ' Change ':
print ' Change password
';
$retval = $handle->changepass ($username, $password);
if ($retval) {
Print "[$username] The password modification was successful.
";
} else {
The password modification for print "[$username] failed.
";
}
Break

Case ' Delete ':
print ' Delete user
';
$retval = $handle->deleteuser ($username);
if ($retval) {
Print "[$username] is deleted.
";
} else {
Print "An error occurred while deleting [$username].
";
}
Break

Case ' Verify ':
print ' Code to verify user ' s password
';
$retval = $handle->verifyuser ($username, $password);
if ($retval) {
Print "[$username] verifies okay with password [$password]
";
} else {
Print "Verify Error for [$username] with [$password] (wrong password or user doesn ' t exist!)
";
}

Break

Default
print ' You want to break?
';
}
echo "";
}
?>

The above describes how to add or subtract in PHP. Users in htpasswd, including the content, want to be interested in PHP tutorial friends helpful.

  • Related Article

    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.