本教程由本站原创,转载请注明来处
作者:www.drise.cn
邮箱:drise@163.com
QQ:271728967
//
现在到了第三步,我们来写type.php文件,这个文件的作用是判断用户名是否存在,再然后数据给用户.
header("Content-type:text/html;charset=gb2312");//为了不让其出现乱码所以把文档编码设置为gb2312
$xm=Strreplace(isset($_GET['txt'])?$_GET['txt']:'null');//取得用户名
if(preg_match("/^[".chr(0xa1)."-".chr(0xff)."]+$/", $xm)){//判断用户名第一个是否为汉字,
echo("
exit();
}
if($xm=='null' || $xm=='' || strlen($xm)>10 || strlen($xm)<3){//判断用户名的合法性
echo("
exit();
}else{
$result=mysql_query("select uname from tablename where uname='$xm' ") or die('Error !'."Error system busy.....plase wait!");
if(!mysql_num_rows($result)){
echo("
}else{
echo("
}
}
?>