Simple user registration program

Source: Internet
Author: User
Step 1: Create the following page. & Lt; html & gt; & lt; head & gt; & lt; title & gt; apply for an account & lt; title & gt; & lt; metahttp-equiv & quot; content-Type & quot; content & quot; texthtml; charsetgb2312 & quot; & gt; & lt; Step 1: Create the following page first.


Apply for an account







   





Step 2: register the execution program.
MySQL_connect ("localhost", "username", "password")/* change the user name and password */
Or die ("unable to connect to the database, please try again ");

Mysql_select_db ("database name ")
Or die ("You cannot select a database, please try again ");
$ Query = "select id from database table name where username = '$ name '";
/* Search for users with the same name from the database */
$ Result = mysql_query ($ query );
$ Numrows = mysql_num_rows ($ result );
If ($ numrows! = 0)

/* If the same user is found, the following prompt is displayed. */
{
$ Temp = 'someone already registered this name. please select another name! ';

}

Else
{
If ($ word! = $ Pass)
{
$ Temp = "inconsistent password input! ";
}
Else
{
If (! Eregi ("^ [a-z] [a-z0-9 _.] {} $", $ name ))
{
$ Temp = "invalid user name .";
}
Else
{
$ Query = "insert into MemberAuth values ('0', '$ name',' $ word', '1', '$ ask', '$ answer ')"; /* enter new user information if the same user information cannot be found */
Mysql_query ($ query );
$ Temp ="
Close the window ";
}
}
}
?>


Apply for an account







   





I am a beginner in php and mysql. I hope you can add more support to the alliance. If you want to execute this program, please register at htpp: // lyjrich.oso.com.cn. Or write to lyjrich@sina.com with me.


[This article is copyrighted by the author and osuo. if you need to reprint it, please indicate the author and its source]

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.