Login login_php Techniques in PHP

Source: Internet
Author: User
Require ". /include/dbclass.php ";
$username =$_post[' username '];
$password =$_post[' password '];
if (Empty ($username) | | empty ($password)) {
Go_msg ("Please fill in username, password!") ",".. /default.html ");
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 ("Registered user has not been audited by admin or username and password!") Please re-enter! ",".. /default.html ");
$Rs = $db-> fetch_array ($result);
Attach value and sign in
Session_register ("username");
Session_register ("usertype");
$_session["Usertype"]= $Rs [' usertype '];
$_session["username"]= $username;
echo $_session["username"];
if ($_session["usertype"]==1) {
Go_msg ("Landing success!") "," default.php ");

Header (' location:http://163.com ');
if ($_session["usertype"]==2) {
Go_msg ("Landing success!") ",".. /user2/default_1.php ");
if ($_session["usertype"]==3) {

Go_msg ("Landing success!") ",".. /user3/default_2.php ");
Header (' Location:default.php ');
Dbclose ();


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.