加PHP用户登陆代码
<!DOCTYPE html> <html> <head> <title>登录</title> <meta name="content-type"; charset=UTF-8"> <style> .zhong{ width: 100%; height: 100px; } .xia{ width: 100%; height: 600px; background: url(C:/Users/lou/Desktop/JC-T/denglu.jpg) ; background-size: ; } a{ text-decoration:none; } .lable{ position:relative; width:280px; height: 300px; background: white; left: 420px; top:100px; float: left; } .ding{ position:relative; left: 160px; top:122px; font-size: 70px; color: white; font-weight: bold; float: left; } a{ color:#9D9D9D; text-decoration:none; } a:visited{ color:#9D9D9D; } input,submit{ background: #9D9D9D; border:0; } p{ margin-left: 30px; } h1{ font-family: "Alex Brush"; font-size:55px; color:darkgreen; } table{ border-spacing:7px; } </style> </head> <body> <!--头部--> <div class="zhong"> <br>      <a href="" style="color:blue;font-size:32px">DDing叮叮</a> <br> </div> <!--中部--> <div class="xia"> <div class="ding"> <p>买书就找叮叮</p> </div> <div class="lable"> <form id="loginform" action="loginaction.php" method="post"> <table border="0" align="center"> <br><br><br> <tr> <td>用户名:</td> <td> <input type="text" id="name" name="username" required="required" value="<?php echo isset($_COOKIE["wang"])?$_COOKIE["wang"]:"";?>"> </td> </tr> <tr> <td>密 码:</td> <td><input type="password" id="password" name="password"></td> </tr> <tr> <td colspan="2" align="center" style="color:red;font-size:10px;"> <!--提示信息--> <?php $err=isset($_GET["err"])?$_GET["err"]:""; switch($err) { case 1: echo "用户名或密码错误!"; break; case 2: echo "用户名或密码不能为空!"; break; } ?> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" id="login" name="login" value="登录"> <input type="reset" id="reset" name="reset" value="重置"> </td> </tr> <tr> <td colspan="2" align="center"> 还没有账号,快去<a style="color:red" href="register.php">注册</a>吧! </td> </tr> </table> </form> </div> </div> <!--脚部--> </body> </html>