php auth_http class library for identity verification_PHP tutorial

WBOY
Release: 2016-07-21 15:47:56
Original
1063 people have browsed it

Copy code 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 user names
'passwordcol'=>"password", //Used for Column for storing passwords
'cryptType'=>"none", //Password encryption method
);
//Create an Auth_HTTP object and specify the use of DB as the information source
$auth = new Auth_HTTP ("DB", $auth_options);
//Description information on the settings dialog box
$auth->setRealm('Login');
//When the identity verification fails or the user cancels Error message
$auth->setCancelText('Identity verification failed!');
//Start user identity verification
$auth->start();
//If Identity verification is successful, display information
if($auth->getAuth())
{
echo "Identity verification is successful, welcome". $auth->username;
};
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319871.htmlTechArticleCopy the code as follows: ?php require_once("Auth/HTTP.php"); //Set the database connection Options$auth_options=array( 'dsn'="mysql://root:1981427@localhost/test", //Database connection word...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!