<!DOCTYPE HTML>
<html>
<body>
<title>Track安全社区</title>
<form action='a.php' name='loginform' methon='post'><br>
用户名:<input type='text' name='username'><br>
密码:<input type='text' name='password'><br>
<input type='submit' value='登录'>
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "mysql";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
$user_name=$_POST['username'];//获取用户名和密码
$password=$_POST['password'];
$sql = "SELECT username,password FROM name where username='"."$user_name"."' 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-1
通过。
评论列表
加载数据中...