Phpauth_http class library for identity verification. Copy the code as follows :? Phprequire_once (AuthHTTP. php); sets the database connection option $ auth_optionsarray (dsnmysql: root: 1981427 @ localhosttest, database connection word
The code is as follows:
Require_once ("Auth/HTTP. php ");
// Set database connection options
$ Auth_options = array (
'Dsn '=> "mysql: // root: 1981427 @ localhost/test", // database connection string
'Table' => "tablename1", // table name
'Usernamecol' => "username", // column used to store the user name
'Passwordcol' => "password", // column used to store passwords
'Crypttype' => "none", // password encryption method
);
// Create an Auth_HTTP object, specifying that the database is used as the information source
$ Auth = new Auth_HTTP ("DB", $ auth_options );
// Description on the setting dialog box
$ Auth-> setRealm ('login ');
// Error message when identity verification fails or the user cancels
$ Auth-> setCancelText ('authentication failed! ');
// Start user identity verification
$ Auth-> start ();
// If the identity verification is successful, the information is displayed.
If ($ auth-> getAuth ())
{
Echo "authentication successful, welcome". $ auth-> username;
};
?>
The http://www.bkjia.com/PHPjc/319871.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/319871.htmlTechArticle code is as follows :? Php require_once ("Auth/HTTP. php "); // Set the database connection option $ auth_options = array ('dsn '=" mysql: // root: 1981427 @ localhost/test ", // database connection word...