php登录代码
供大家参考
<?php error_reporting(0); header("content_type:text/html;charset=gbk"); $conn=mysql_connect("localhost","root","") or die("链接错误"); mysql_select_db("phptest",$conn); // echo "链接成功"."<br>"; $username=$_POST['username']; $password=$_POST['password']; // echo "用户输入的是:"."$username"."<br>"."$password"; $sqla="select * from user"; $sqlb="select * from user where username='$username'"; $sqlc="select * from user where username='$username' and password='$password'"; $resulta=mysql_query($sqla,$conn); $resultb=mysql_query($sqlb,$conn); $resultc=mysql_query($sqlc,$conn); $numa=mysql_num_rows($resulta); $numb=mysql_num_rows($resultb); $numac=mysql_num_rows($resultc); if($username=="" or $password==""){ echo "用户名或密码不能为空"; }else if($numb>0 ){ while($all=mysql_num_rows($result)){ echo "$all[username]"." "."$all[password]"."<br>"; } } ?> <html> <body> <form action="newTest.php" method="post"> <ul> <li>username:<input type="text" name="username"/></li> <li>password:<input type="text" name="password"/></li> <li><input type="submit" name="sub"value="sub"/></li> </ul> </form> </body> </html>
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23