码迷,mamicode.com
首页 > 其他好文 > 详细

登入界面

时间:2020-02-29 20:46:48      阅读:67      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!