<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title> 3.5 </title>
</head>
<body>
<p>用户登陆</p>
<form action="http://www.xxxxxxxx.com/xxx.php" method=get>
<table border="1">
<tr>
<td align="left">name:</td>
<td align="left"><input type="text" name= "name"></td>
<tr>
<td align="left">password:</td>
<td align="left"><input type="password" name ="password1"></td>
</table>
<input type ="checkbox" name="auto" >自动登陆<br/>
<input type ="submit" value="登陆" />
</form>
</body>
</html>
<?php
$conn=mysqli_connect("localhost","hello","hello")
if(!$conn)
{
die('Could not connect '. mysql_eorr());
}
mysql_select_db("mydb",$conn);
$result=mysqli_query($conn,"SELECT * FROM user WHERE username='$name' and password='password'");
if($result==false)
echo "账号或者密码错误";
else
echo "登陆成功";
mysql_close($conn);
?>
打赏我,让我更有动力~
© 2016 - 2024 掌控者 All Rights Reserved.
Track-方丈
发表于 2018-7-18
每行php语句结束必须使用分号。
mysqli系列函数和mysql系列函数不得混用。
在PHP代码中未获取表单数据。
评论列表
加载数据中...