User login means that the user enters the user name and password, clicks on the login page without refreshing, and then uses ajax to submit it to the background program for judgment. If the login is successful, it returns true or relevant user information, thus achieving the user's no-refresh login effect.
php Jquery login without refresh, a very simple one written by myself
Added a judgment that if you are already logged in, the login status will still be displayed after refreshing
Login page file
html page
The code is as follows
|
Copy code
|
||||
|
postdata(); //Execute the postdata function when the button is clicked
}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.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632748.htmlTechArticleUser login means that the user enters the user name and password, clicks on the login page without refreshing, and then uses ajax to submit to the background program for judgment. If Login successfully returns true or relevant user information, so... |