Log on to login in php. Login? Phprequire .. includeDBClass. php; $ username $ _ POST [UserName]; $ password $ _ POST [Password]; if (empty ($ username) | empty ($ password )) {Go_Msg (enter the user name and password! Login
Require "../include/DBClass. php ";
$ Username = $ _ POST ['username'];
$ Password = $ _ POST ['password'];
If (empty ($ username) | empty ($ password )){
Go_Msg ("Enter the user name and password! "," ../Default.html ");
Exit;
}
DBConn ();
$ Password = md5 ($ password );
$ SQL = "Select UserName, UserType, UserPass From siteuser where UserName = '". $ username. "' and UserPass = '". $ password. "' and isopen = 1 ";
// Echo "$ SQL ";
$ Result = $ db-> exec_ SQL ($ SQL );
$ Total = mysql_num_rows ($ result );
If ($ total = 0 ){
DBClose ();
Go_Msg ("the registered user has not passed the administrator review or the user name and password do not match! Enter again! "," ../Default.html ");
Exit;
} Else {
$ Rs = $ db-> fetch_array ($ result );
// Add a value and log on
Session_register ("username ");
Session_register ("usertype ");
$ _ SESSION ["usertype"] = $ Rs ['usertype'];
$ _ SESSION ["username"] = $ username;
// Echo $ _ SESSION ["username"];
If ($ _ SESSION ["usertype"] = 1 ){
Go_Msg ("login successful! "," Default. php ");
// Header ('Location: http://163.com ');
}
If ($ _ SESSION ["usertype"] = 2 ){
Go_Msg ("login successful! "," ../User2/default_1.php ");
}
If ($ _ SESSION ["usertype"] = 3 ){
Go_Msg ("login successful! "," ../User3/default_2.php ");
}
// Header ('Location: default. php ');
}
DBClose ();
?>
Http://www.bkjia.com/PHPjc/317772.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/317772.htmlTechArticlelogin? Php require ".. /include/DBClass. php "; $ username = $ _ POST ['username']; $ password = $ _ POST ['password']; if (empty ($ UserName) | empty ($ password) {Go_Msg ("Enter the user name and password !...