php登陆和注册

2018-06-22 05:30:22来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

注册界面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="conduct.php" method="post">
    <input type="text" name="name" placeholder="用户名">
    <input type="password" name="dw" placeholder="密码">
    <input type="submit" value="提交">
</form>
</body>
</html>

注册处理界面

<?php

$name = $_POST['name'];
$dw = md5($_POST['dw']);
require_once "../ZY/YIN.class.php";
$db = new YIN();
$obj = "select count(*) from zc WHERE uname = '{$name}'";
$data = $db->StrQuery($obj);
//var_dump($data);
if ($data!='0'){
    exit("用户名重复");
}else{
    $sql = "insert into zc VALUES (NULL,'{$name}','{$dw}','')";
    $data = $db->Query($sql,0);
    echo "注册成功";
}

登陆界面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form method="post" action="dlcl.php">
    <input type="text" name="uname" placeholder="用户名">
    <input type="password" name="m" placeholder="密码">
    <input type="submit" value="登陆">
</form>

</body>
</html>

登陆处理

<?php

$name = $_POST['uname'];
$m = $_POST['m'];
//var_dump($_POST);
require_once "YIN.class.php";
$db = new YIN();
$obj = "select count(*) from zc WHERE uname = '{$name}'";
$data = $db->StrQuery($obj,1);
//var_dump($data);
if ($data != "0" ){
//    echo "成功";
$obj_m = "select count(*) from zc WHERE pad = '{$m}'";
$data_m = $db->StrQuery($obj_m,1);
if ($data_m!="0"){
//    var_dump($data_m);
    echo "登陆成功";
}else{
    header("location:denglu.php");
}
}else{
    header("location:denglu.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:macos 新版mysql数据库中文显示问号乱码问题解决方案

下一篇:PHP封装的mysqli增、删、改、查的类