The content of this article is about using PHP to write the code for the registration interface. Now I share it with everyone. Friends in need can refer to it
<?php $name=$_POST['name']; $password=$_POST['password']; $password1=$_POST['password1']; if($name=="") { echo "用户名不能为空"; echo "<meta http-equiv=refresh content='2 url=long.php'>"; exit(); } $password=$_POST['password']; if($password=="") { echo"密码不能为空"; echo "<meta http-equiv=refresh content='2 url=long.php'>"; exit(); } if(strlen($password)>16 or strlen($password)<6) { echo "请你输入一个6到16位的密码"; echo "<meta http-equiv=refresh content='2 url=long.php'>"; exit(); } if(strcmp($password1,$password)!=0) { echo "你输入的两次密码不一致"; echo "<meta http-equiv=refresh content='2 url=long.php'>"; exit(); } include"connect.php"; $sql="select *from rz where users='$name'"; $query=mysql_query($sql); if($r=mysql_fetch_array($query)) { echo "此帐号已被人占用"; exit(); } $password=md5($password); $sql="insert into rz(users,password) values('$name',md5('$password'))"; $query=mysql_query($sql); echo "成功增加用户"; echo "<br>你好!".$name; echo $name."你已成为本站的一位新用户,系统将在5秒后返回开申请页面"; echo "<meta http-equiv=refresh content='5 url=long.php'>"; ?>
Related recommendations:
How to collect article pages of WeChat public accounts using PHP
The above is the detailed content of Write registration interface in php. For more information, please follow other related articles on the PHP Chinese website!