Write registration interface in php

不言
Release: 2023-03-23 13:18:02
Original
5127 people have browsed it

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[&#39;name&#39;]; 
$password=$_POST[&#39;password&#39;]; 
$password1=$_POST[&#39;password1&#39;]; 
if($name=="") 
{ 
echo "用户名不能为空"; 
echo "<meta http-equiv=refresh content=&#39;2 url=long.php&#39;>"; 
exit(); 
} 
$password=$_POST[&#39;password&#39;]; 
if($password=="") 
{ 
echo"密码不能为空"; 
echo "<meta http-equiv=refresh content=&#39;2 url=long.php&#39;>"; 
exit(); 
} 
if(strlen($password)>16 or strlen($password)<6) 
{ 
echo "请你输入一个6到16位的密码"; 
echo "<meta http-equiv=refresh content=&#39;2 url=long.php&#39;>"; 
exit(); 
} 
 if(strcmp($password1,$password)!=0) 
 { 
 echo "你输入的两次密码不一致"; 
 echo "<meta http-equiv=refresh content=&#39;2 url=long.php&#39;>"; 
 exit(); 
 } 
include"connect.php"; 
$sql="select *from rz where users=&#39;$name&#39;"; 
$query=mysql_query($sql); 
if($r=mysql_fetch_array($query)) 
{ 
 echo "此帐号已被人占用"; 
 exit(); 
} 
$password=md5($password); 
$sql="insert into rz(users,password) values(&#39;$name&#39;,md5(&#39;$password&#39;))"; 
$query=mysql_query($sql); 
echo "成功增加用户"; 
echo "<br>你好!".$name; 
echo $name."你已成为本站的一位新用户,系统将在5秒后返回开申请页面"; 
echo "<meta http-equiv=refresh content=&#39;5 url=long.php&#39;>"; 
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template