1. 云栖社区>
  2. PHP教程>
  3. 正文

php登陆和注册

作者:用户 来源:互联网 时间:2017-11-30 14:01:07

php登陆注册

php登陆和注册 - 摘要: 本文讲的是php登陆和注册, 注册界面 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</

注册界面

<!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>

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索php , 登陆 注册 ,以便于您获取更多的相关知识。

弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率

40+云计算产品,6个月免费体验

现在注册,免费体验40+云产品,及域名优惠!

云服务器9.9元/月,大学必备