[Original] Ajax implementation of user registration function tutorial three_PHP tutorial

WBOY
Release: 2016-07-13 17:11:39
Original
722 people have browsed it

//[Original] Ajax implementation of user registration function tutorial three

This tutorial is original from this site, please indicate the source when reprinting

Author: www.drise.cn

Email:drise@163.com

QQ:271728967

//

Now in the third step, let’s write the type.php file. The function of this file is to determine whether the user name exists, and then give the data to the user.

header("Content-type:text/html;charset=gb2312");//In order to prevent it from being garbled, the document encoding is set to gb2312
$xm=Strreplace(isset($_GET['txt'])?$_GET['txt']:'null');//Get username
if(preg_match("/^[".chr(0xa1)."-".chr(0xff)."]+$/", $xm)){//Determine whether the first user name is a Chinese character,
echo("

Sorry, you cannot use Chinese as your username!
");
exit();
}
if($xm=='null' || $xm=='' || strlen($xm)>10 || strlen($xm)<3){//Determine the legitimacy of the user name
echo("
Sorry, the user name you entered is illegal. The user name consists of 3-10Aa_zZ and numbers!
");
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("
Congratulations! Your username ".$xm." has not been registered yet, you can register!
");
}else{
echo("
Sorry, the user has already registered, please choose another name!
");
}
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629574.htmlTechArticle//[Original] Ajax implementation of user registration function tutorial. Three tutorials are original from this site. Please indicate when reprinting. Author: www.drise.cn Email: drise@163.com QQ:271728967 // Now to the third step, let’s...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!