This article describes how to check and store user registration information in php. The Code is as follows: query (setnamesgb2312); if (empty ($ conn )) {die (Database Connection Failed);} $ UserName $ _ POST [username]; $ pwd $ _ POST [password]; $ email $ _ POST [email]; $ sex $ _ POST [sex]; $ timetime (); $ codestrtolowe
This article describes how to check and store user registration information in php. The Code is as follows: query (set names gb2312); if (empty ($ conn )) {die (Database Connection Failed) ;}$ UserName =$ _ POST [username]; $ pwd =$ _ POST [password]; $ email =$ _ POST [email]; $ sex = $ _ POST [sex]; $ time = time (); $ code = strtolowe
This article introduces an example of how to check and store user registration information in php. The Code is as follows:
Query ('set names gb2312 '); if (empty ($ conn) {die ("database connection failed");} $ UserName = $ _ POST ['username']; $ pwd =$ _ POST ['Password']; $ email =$ _ POST ['email ']; $ sex =$ _ POST ['sex']; $ time = time (); $ code = strtolower ($ _ POST ["code"]); $ str = "select * from users where username = '". $ username. "'"; $ result1 = $ conn-> query ($ str); $ row = $ result1-> fetch_row (); if ($ row) {$ temp = "already registered this name. Please select another name! "; Echo $ temp; echo" back ";} else {if ($ _ SESSION ['sname'] = $ code) {echo $ temp =" authentication code successful "; $ SQL = "INSERT INTO users VALUES ('$ username',' $ password', '$ email', '$ sex',' $ Time ')"; $ result = $ conn-> query ($ SQL); if ($ result = true) {$ _ SESSION ['mail'] = "registration successful, please log in "; echo "";} else {echo "registration failed ". mysql_error () ;}} else {echo "Incorrect verification code" ;}}?>
The above code receives parameters from the registration page, including the user name, password, email address, gender, and verification code. Then, check whether the registration has been completed. Otherwise, write the registration information to the database. Very simple, especially suitable for reference by new friends.