<!doctype html>
<html>
<head>
<meta charest="utf-8"/>
<title>登录表单</title>
</head>
<body>
<p>管理员登录</p>
<form action="haha.php" method="post">
<input type="heihei"name="username"/><br>
<input type="heihei"name="jpassword"/><br>
<input type="submit"name="提交">
</form>
</body>
</html>
<?php
head('content-type:1/html;charset=utf-8');
$username=$_post['username'];
$password=$_post['password'];
$conn=mysqli_connect("localhost","root","root","db_name");
if(!$con)
{
die('could not connect:'.mysql_error);
}
$result=mysqli_query($conn,"select"from user where
username='".mysql_real_escape_string($username)."')
$row=mysql_fetch_row($result);
if($row>0)
{
echo“登录成功”;
}
else
{
echo“用户密码不正确”;
}
mysqli_close($sonn);
?>
打赏我,让我更有动力~
© 2016 - 2024 掌控者 All Rights Reserved.
Track-方丈
发表于 2018-7-29
表单的name要对应php中$_POST的键值。
评论列表
加载数据中...