标签:pos rom erro cno var_dump post href utf-8 mil
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登入</title>
</head>
<body>
<?php
if ($_POST) {
$name = trim($_POST[‘name‘]);
$pasd = md5(trim($_POST[‘pasd‘]));
$cno = new mysqli(‘localhost‘, ‘root‘, ‘root‘, ‘aaa‘);
if ($cno->connect_error) {
echo $cno->error;
} else {
$sql = "select * from kaoshi where name = ‘$name‘ and mima = ‘$pasd‘";
$res = $cno->query($sql);
if (!$res) {
echo $cno->error;
} else {
if ($res->num_rows > 0) {
$arr = $res->fetch_assoc();
setcookie(‘admin‘,$arr[‘id‘]);
// var_dump($arr);
// 登入index
header(‘location:/index.php‘);
} else {
echo ‘账号或密码错误‘;
}
}
}
$cno->close();
};
?>
<form action="" method="post" >
账号:<input type="text" name="name" id="name"><br>
密码:<input type="password" name="pasd" id="pasd"><br>
<a href="http://www.q.com/zhuce.php" target="_blank">注册</a>
<input type="submit" name="" value="登入">
</form>
</body>
</html>
标签:pos rom erro cno var_dump post href utf-8 mil
原文地址:https://www.cnblogs.com/wangzihao147/p/12384846.html