[Original] ajax user registration function tutorial 3 _ PHP Tutorial

Source: Internet
Author: User
[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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.