For the php registration page, check whether the user input meets the requirements without running this step. could you tell me what went wrong? PHPcode & lt ;? Php // new user registration function functionregister () {// definition of two variables $ str1 = & quot; & lt; p & gt; user NOTE: & lt; /p & gt; the php registration page does not run the check to check whether the user input meets the requirements. could you tell me what went wrong?
PHP code
Note: Read the following carefully:
----------------
---- Agreement content ----
----------------
Agree to disagree
"; $ Str2 =" "; // Determine how to deal with the next step based on the message value $ msg = $ _ GET [" message "]; if (! Isset ($ msg) $ msg =$ _ POST ["message"]; if ($ msg = 'new') {echo $ str1; exit ();} elseif ($ msg = 'agree ') {echo $ str2; exit ();} elseif ($ msg = 'Reg ') {// check whether user input meets the requirements $ username =$ _ POST ["username"]; $ password =$ _ POST ["passwd"]; $ repasswd =$ _ POST ["repasswd"]; $ passwda =$ _ POST ["passwdpa"]; $ passwdq =$ _ POST ["passwdq"]; if ($ username = "" | $ password = "" | $ repasswd = "" | $ passwdq = "" | $ passwda = "") {echo "required item cannot be blank! ";} If ($ password! = $ Repasswd) {echo "inconsistent passwords! ";}// Check whether a user with the same name exists in the database $ conn = @ mysql_connect (" localhost "," root ","") or die ("failed to connect to database"); mysql_select_db ("project", $ conn); $ SQL = "SELECT username FROM member WHERE usename = '$ username '"; $ result = mysql_query ($ SQL); if (mysql_fetch_object ($ result) {mysql_close ($ conn); echo "the user name already exists! ";}// INSERT user data INTO the database $ SQL = 'Insert INTO member (username, password, userpassq, userpassa, email, telephone, address) VALUES ('. $ _ POST ['username']. ','. $ _ POST ['passwd']. ','. $ _ POST ['passdp ']. ','. $ _ POST ['passda']. ','. $ _ POST ['email ']. ','. $ _ POST ['tel']. ','. $ _ POST ['add']. ')'; if (mysql_query ($ SQL) {$ sql2 = "SELECT id FROM Member WHERE username = '$ username'"; $ result = mysql_query ($ sql2 ); $ res = mysql_fetch_object ($ result); $ Id = $ res-> id; session_register ($ memberid); $ reuturnpage = "Location: loginscreen. php? Username = '$ username' "; mysql_close ($ conn); header ($ returnpage);} else {mysql_close ($ conn); header (" Location: register. php? Message = ". urlencode (" registration failed! Please try again "); exit ;}} else {$ msg =$ _ GET [" message "]; echo $ msg; exit () ;}// page section?> User registration page