电脑安全

您当前的位置:主页 > 电脑安全 >

用户的详细注册和判断-网络编程

来源:[db:来源]标题:   为空    编辑:电脑技术全能网 时间:2019-09-21 12:24

原标题:用户的详细注册和判断-网络编程
   有三个文件:   第一是:zcyh.php(注册用户名)<?include("header1.inc.php")?>   <div align=center>   <table width="89%" border="0">   <tr>  <td><font color="#ff0000">以后地位:<a href="index.php">主页</a>&gt;&gt;注册页面</font></td>   </tr>   </table><br>     <table width="82%" border="0" height="27">   <tr>  <td height="14"><b><font color="#660099"><img src="images/dyb.gif" width="68" height="22">  请设定用户名:(<font color="#FF0000">3-15位</font>)</font></b></td>   </tr>   </table>   <form name="form1" method="post" action="register.php">   <table width="80%" border="0" height="154">   <tr>  <td width="42%">  <div align="right"><font color="#0000FF">用户名:</font>   </td>   <td width="58%">  <input type="text" name="name" maxlength="20">   </td></div>   </tr>   <tr>  <td colspan="2" height="27">  <div align="left"><font size="2"><font color="#FF0000">留神:</font><font color="#0000FF">用户名只能由英笔墨母(a-z),数字(0-9)和下划线('_'、'-'、'.'  )形成,不能有空格,且必需以英笔墨母为扫尾。 </font></font> </div>   </td>   </tr>   <tr>  <td colspan="2" height="14">  <div align="left"><font size="2"><font color="#FF0000">比方:</font></font></div>   </td>   </tr>   <tr>  <td colspan="2">  <div align="center"><font size="2" color="#FF0000"><b><font color="#0000FF">√</font></b>准确的例子:jocky、lin_xing、nh2001</font></div>   </td>   </tr>   <tr>  <td colspan="2">  <div align="center"><font size="2" color="#FF0000"><b><font color="#0000FF">×</font></b>过错的例子:li  kitty、ming:)、168kk</font></div>   </td>   </tr>   <tr>  <td colspan="2" height="18">  <div align="center"><font size="2" color="#0000FF">假如你曾经填写好,请点“</font><font size="2"><font color="#FF0000">下一步</font><font color="#0000FF">”按钮;  点“</font><font color="#FF0000">撤消</font><font color="#0000FF">”按钮即撤消您方才的输出,从新开端。</font>  </font></div>   </td>   </tr>   <tr>  <td colspan="2" height="19">  <div align="center">    <input type=image name=name2 src="images/xyb.gif" width="68" height="22" border="0">   <input type=hidden name=name3 value=<?echo$name?>>    <a href="zcyh.php"><img src="images/cancel.gif" width="68" height="22" border="0"></a></div>   </td>   </tr>   </table>   </form>    <br>     </div>   <br>   <?include("foot.inc.php")?>   </body>   </html>   第二个是:register.php(推断注册用户名能否准确和能否反复,而后输入注册的具体表单)   <?include("header1.inc.php")?>   <div align=center>   <table width="89%" border="0">   <tr>  <td><font color="#ff0000">以后地位:<a href="index.php">主页</a>&gt;&gt;<a href=zcyh.php>注册页面</a>&gt;&gt;具体材料</font></td>   </tr>   </table><br>   <?   if($name==""){   echo"<br><center><font color=blue>用户名不能为空。请</font><a href=zcyh.php>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if(strlen($name)<3 || strlen($name)>15){   echo"<br><center><font color=blue>用户名的长度不合乎请求。请</font><a href=zcyh.php>前往</a></center><br>";   include("foot.inc.php");   exit();   }    if (!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*$", $name)) {   echo"<br><center><font color=blue>注册名只能由字母数字构成.请</font><a href=zcyh.php>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if ($name)   {  $conn=@mysql_connect("localhost");   $sql=@mysql_select_db("jocky",$conn);   $result=@mysql_query("select * from user1 where name='$name'" ,$conn);   if($result){   if(@mysql_fetch_object($result)){   echo"<br><center><font color=blue>对不起,曾经有雷同的用户名!请</font><a href=zcyh.php>前往</a>.</center><br>";}   else{$conn=@mysql_connect("localhost");   $sql=@mysql_select_db("jocky",$conn);   $sqldo="insert into user1 (name) values ('$name')";   @mysql_query($sqldo,$conn);   echo"<br><center><font color=blue>你好,</font>";   echo"<font color=red><b>$name</b></font></center>";   include("zhuce.php");   @mysql_close($conn);}   include("foot.inc.php");   exit();   }   }   ?>   </div>   <?include("foot.inc.php")?>   </body>   </html>   第三个是:check.php(推断注册材料能否准确,而后拔出数据库,从新登录)   <?include("header1.inc.php")?>    <div align=center>  <table width="89%" border="0">   <tr>  <td><font color="#ff0000">以后地位:<a href="index.php">主页</a>&gt;&gt;<a href=zcyh.php>注册页面</a>&gt;&gt;具体材料</font></td>   </tr>   </table><br>   <?   if($truename==""){   echo"<br><center><font color=blue>实在姓名不能为空。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if($password==""||$repassword==""){   echo"<br><center><font color=blue>暗码不能为空。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if($repassword!=$password){   echo"<br><center><font color=blue>两次输出的暗码纷歧样。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if(strlen($password)<6 || strlen($password)>15){   echo"<br><center><font color=blue>暗码的长度不合乎请求。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if($pwwhat==""){   echo"<br><center><font color=blue>暗码提醒成绩不能为空。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if($pwan==""){   echo"<br><center><font color=blue>暗码提醒谜底不能为空。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if($personalid==""){   echo"<br><center><font color=blue>身份证号码不能为空。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if(strlen($personalid)!=15 or strlen($personalid)!=18){   echo"<br><center><font color=blue>输出的身份证号码不是15位或18位。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }*/   if($year=="" || $month=="" || $day==""){   echo"<br><center><font color=blue>诞生年代日没有填。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if(strlen($year)!=4 || strlen($month)!=2 || strlen($day)!=2){   echo"<br><center><font color=blue>输出的年代日不准确。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if (!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$email)) {    echo"<br><center><font color=blue>E-Mail地点格局错误。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if($tel==""){   echo"<br><center><font color=blue>接洽的电话不能为空。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if(strlen($tel)!=11 || strlen($tel)!=12 || strlen($tel)!=13){   echo"<br><center><font color=blue>接洽的电话长度不准确。请</font><a href=javascript:history.go(-1);>前往</a></center><br>";   include("foot.inc.php");   exit();   }   if($gender==""){   $null1="空";}   if($xueli==""){   $null2="空";}   if($money==""){   $null3="空";}    if($addr==""){   $null4="空";}   $birthday="$year.-.$month.-.$day";   $time=time();   $conn=@mysql_connect("localhost");   $sql=@mysql_select_db("jocky",$conn);   $result=@mysql_query("select * from user1 where name='$name'" ,$conn);   $sqldo="insert into user1 (name,truename,password,pwwhat,pwan,personalid,gender,xueli,birth,email,tel,money,addr,time) values('$name','$truename','$password','$pwwhat','$pwan','$personalid','$null1','$null2',";   $sqldo.="'$birthday','$email','$tel','$null3','$null4','$time')";   $query=@mysql_query($sqldo,$conn);   if($query){   echo"<br><center><font color=blue>祝贺你,你已注册胜利!请</font><a href=index.php>登录</a></center><br>";   exit();   }else{   echo"<br><center><font color=blue>效劳器忙,不能为你注册,请稍后再注册!</font><a href=index.php>回主页</a></center><br>";   }   @mysql_close($conn);   ?>   </div>   <?include("foot.inc.php")?>   </body>   </html>

上一篇:php smarty 基础-网络编程

下一篇:没有了