Home  >  Article  >  Backend Development  >  PEAR application AUTH_HTTP_PHP tutorial

PEAR application AUTH_HTTP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:36:521126browse

Using AUTH_HTTP, you can easily build programs based on HTTP authentication, and you can freely specify user data tables, which is simple and easy to use...
Example:
require_once("Auth/HTTP.php");
$options = array(
dsn=>"mysql://root:@localhost/test", //Database connection string
table= & gt; "test_http", // User table
usernamecol = & gt; "name", // user name field
passwordcol = & gt; "passwd", // User password field
crypttype = & gt; " md5",                                                                                                                                                                                           
$a->setRealm(yourrealm); // realm name
$a->setCancelText(Error 401); // Prompt message when verification fails
$a->start() ;                                                                        

if($a->getAuth()) // Success

{
echo "Hello $a->username welcome to my secret page";
echo $a->getAuthData (userid); // Get other fields

echo $a->getAuthData(telephone); //

echo $a->getAuthData(email);

//print_r($a);
};
?>

Add this program before the program to be verified..


http://www.bkjia.com/PHPjc/486623.html

www.bkjia.com

truehttp: //www.bkjia.com/PHPjc/486623.htmlTechArticleUsing AUTH_HTTP, you can easily build a program based on HTTP authentication, and you can freely specify the user data table, which is simple to operate. Easy to use... Example: ?php require_once("Auth/HTTP.php"); $options...
Statement:
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