Interface d'inscription
<!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>
Interface de traitement d'inscription
<?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 "注册成功"; }
Interface de connexion
<!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>
Traitement de connexion
<?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>
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!