PHP develops user login function of simple book lending system
We have successfully registered and saved the information in the database.
Now we can fill in the registered information in the login text box. As long as the login information matches the registration information, we can successfully log in and jump to the home page.
Here you need to judge the submit in .
Determine whether you are logged in based on the id stored in the session. If you are already logged in, the login will end.
alert('您已登陆');window.location='index.php'"; // 登录过的话,立即结束 exit; } } ?>
session variables are used to store information about the user session (session), or to change the settings of the user session (session).
Get the POST parameters and check whether the username and password match through SQL statements.
alert('登陆成功');window.location='index.php'"; } else { // 管理员登录失败 echo ""; } ?>
md5() function is used to encrypt files.