本篇文章介绍的内容是关于用php写注册界面的代码,现在分享给大家,有需要的朋友可以参考一下

<?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'>"; 
?>
登录后复制

相关推荐:

PHP写微信公众号文章页采集方法


以上就是用php写注册界面 的详细内容,更多请关注Work网其它相关文章!

09-17 10:35