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.