Create a page named yz.php
Copy the Code code as follows:
Require_once (' auth.php ');
function Show_login_form () {
Echo '
Username
Password
' ;
}
$opti//root:1@localhost/zs ',
' Table ' = ' users ',
' Usernamecol ' = ' user_name ',
' Passwordcol ' = ' user_passwd ',
' Crypttype ' = ',
' Db_fields ' = ' * ',
);
$auth =new auth (' DB ', $options, ' show_login_form ');
?>
$auth->start ();
if ($auth->checkauth ()) {
echo "OK";
echo "
";
echo "Add";
}else {
echo "Error";
}
$auth->setsessionname ($auth->getauthdata (' user_name '));
?>
The page yzh.php after the login session is passed
Copy the Code code as follows:
function back () {
Echo ' Back ';
}
Require_once (' auth.php ');
$auth =new auth (' DB ', $option, ' back ');
$auth->start ();
if ($auth->checkauth ())
{
echo "This is a session page,welcome";
echo "{$auth->getusername ()}";
}
?>
The above describes the P2psearcher green installation version based on Pear auth implementation of login verification, including the P2psearcher Green installation version of the content, I hope that the PHP tutorial interested in a friend helpful.