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]