<!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 ="password"></td>
</table>
<input type ="checkbox" name="auto" >自动登陆<br/>
<input type ="submit" value="登陆" />
</form>
</body>
</html>
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("连接失败: " . mysqli_connect_error());
}
$UserName=$_POST['name'];
$Password=$_POST['password'];
$sql = "SELECT id FROM table where username=$UserName and password=$Password";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0) {
echo "登录成功";
}
else {
echo "账号或密码错误";
}
mysqli_close($conn);
?>
</body>
</html>
打赏我,让我更有动力~
© 2016 - 2024 掌控者 All Rights Reserved.
Track-方丈
发表于 2018-7-19
通过,金币奖励已发放
评论列表
加载数据中...