PHP develops complete login implementation code for simple book lending system

You need to introduce the database file config.php and the public file head.php

 

The following is the complete login page code, the file name is landing.php.

    简单图书借阅系统登录  
alert('退出成功!');window.location='landing.php'"; } if(isset($_POST['submit'])){ // 如果已经登录过,直接退出 if(isset($_SESSION['id'])) { //重定向到管理留言 echo ""; // 登录过的话,立即结束 exit; } // 获得参数 $nickname=$_POST['username']; $password=$_POST['password']; //$password=md5($password); // 检查帐号和密码是否正确, $sql="select * from user where name='$nickname' and password='$password'"; $re = mysqli_query($link,$sql); $result=mysqli_fetch_array($re); // 如果用户登录正确 if(!empty($result)) { //注册session变量,保存当前会话用户的昵称 $_SESSION['id']=$result['id']; // 登录成功重定向到管理页面 echo ""; } else { // 管理员登录失败 echo ""; } } ?>
用户登录
用户名:
密 码:
注册新用户


Continuing Learning
||
简单图书管理系统登录
用户登录
用户名:
密 码:
注册新用户
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!