giveneye 发表于 2013-2-7 15:22:23

ajax验证用户名

<?phpheader("Content-type:text/html;charset=gb2312");require_once('inc/connect.php');$xm=isset($_GET['txt'])?$_GET['txt']:'null';if(preg_match("/^[".chr(0xa1)."-".chr(0xff)."]+$/", $xm)){echo("<div id='error'>对不起,不能使用中文作为用户名! </div>");exit(); }if($xm=='null' || $xm=='' || strlen($xm)>10 || strlen($xm)<3){ echo("<div id='error'>对不起,用户由3-12Aa_zZ及数字组成! </div>"); exit();}else{ $result=mysql_query("select m_uid from wk_member where m_uid='$xm' ") or die('Error !'.mysql_error()); if(!mysql_num_rows($result)){echo("<div id='success'><font color=red>    恭喜你!此用户可以注册!</font> </div>"); }else{echo("<div id='error'>对不起,用户己被注册请选择其它名称!</div>"); }}?> 
页: [1]
查看完整版本: ajax验证用户名