<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<title>T安全社区登录</title>
</head>
<body>
<p>管理员登录</p>
<form action="a.php" method="POST">
管理员名:<input type="text" name="username" value=""><br>
密码: <input type="password" name="password" value="">
<br>
<input type="submit" name="submit" value="提交">
</form>
</body>
</html>
<?php>
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect:'. mysql_error());
}
mysql_query("SET NAMES utf8");
mysql_select_db("user",$con);
$username = $_POST['username'] ;
$password = $_POST['password'];
$sql = "SELECT id FROM user WHERE username= '$username' and password = '$password'" ;
$result = mysql_query($sql,$con) ;
$row = mysql_fetch_array($result) ;
if($row>0)
{
echo 'success';
}
else
{
echo 'failed'.mysql_error();
}
mysql_close($con);
?>
打赏我,让我更有动力~
© 2016 - 2024 掌控者 All Rights Reserved.
Track-方丈
发表于 2018-7-5
通过。
10金币已发放。
评论列表
加载数据中...