[Original] Tutorial 3 on implementing the user registration function using ajax. [Original] ajax implementation of user registration function tutorial three tutorials by the site original, reproduced please indicate the author: www.drise.cn mailbox: drise@163.comQQ: 271728967 now to the third step, let's // [original] ajax implementation user registration function tutorial 3
This tutorial is original on this site.
Author: www.drise.cn
Email: drise@163.com
QQ: 271728967
//
Now the third step is to write the type. php file, which is used to determine whether the user name exists and then send the data to the user.
Header ("Content-type: text/html; charset = gb2312"); // Set the document encoding to gb2312 to prevent gibberish.
$ Xm = Strreplace (isset ($ _ GET ['txt '])? $ _ GET ['txt ']: 'null'); // obtain the user name
If (preg_match ("/^ [". chr (0xa1 ). "-". chr (0xff ). "] + $/", $ xm) {// determines whether the first user name is a Chinese character,
Echo ("
Sorry, you cannot use Chinese as the user name!
");
Exit ();
}
If ($ xm = 'null' | $ xm = ''| strlen ($ xm)> 10 | strlen ($ xm) <3) {// determine the validity of the user name
Echo ("
Sorry, the user name you entered is invalid. 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! User name ". $ xm." is not yet registered. you can register it!
");
} Else {
Echo ("
Sorry, you have registered. please select another name!
");
}
}
?>
Login to achieve user registration function tutorial three this tutorial by the site original, reproduced please indicate the author: www.drise.cn mailbox: drise@163.com QQ: 271728967 // Now to the third step, we come...