PHP jquery Ajax User Login Instance Code _php tutorial

Source: Internet
Author: User
User login is the user entered the user name password click on the login page does not refresh and then use Ajax submitted to the background program to determine if the login successfully returned TRUE or related user information, so that the user has no refresh login effect.

PHP Jquery No flush login, write yourself a very simple
Added a judgment is that if it is already logged in, after the refresh is still displayed the login status
Login Page File
HTML page

The code is as follows Copy Code










Send To File

The code is as follows Copy Code

Session_Start ();
Require "conn.php";
$username =$_post[' writer '];
$password =$_post[' pass ';
mysql_select_db ($database _lr, $LR);
$sql = "SELECT * from admin WHERE username= ' $username ' and password= ' $password '";
$result = mysql_query ($sql);
if (mysql_num_rows ($result) >0)
{
Login sucess
$_session[' login_admin ']= "Admin";
echo "Login OK";

}
Else
{
The user ID found
echo "Login failed, ID error or expired.";
}

?>

http://www.bkjia.com/PHPjc/632748.html www.bkjia.com true http://www.bkjia.com/PHPjc/632748.html techarticle User login is the user entered the user name password click on the login page does not refresh and then use Ajax submitted to the background program to determine if the login successfully returned TRUE or related user information, so ...

  • 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.