Copy the code The code is as follows:
require_once("Auth/HTTP.php");
//Set the database connection options
$auth_opti
'dsn'=>"mysql: //root:1981427@localhost/test", //Database connection string
'table'=>"tablename1", //Table name
'usernamecol'=>"username", //Used to store username Column
'passwordcol'=>"password", //Column used to store passwords
'cryptType'=>"none", //Password encryption method
);
//Create Auth_HTTP object, specify DB As a source of information
$auth = new Auth_HTTP("DB", $auth_options);
//Description information on the settings dialog box
$auth->setRealm('Login');
//Identity verification failed or user Error message when canceling
$auth->setCancelText('Identity verification failed!');
//Start user identity verification
$auth->start();
//If identity verification is successful, Display information
if($auth->getAuth())
{
echo "Identity verification successful, welcome". $auth->username;
};
?>
The above introduces the http://zikao.hneao.cn/net/ php auth_http class library for identity verification, including the content of http://zikao.hneao.cn/net/. I hope that friends who are interested in PHP tutorials Helps.