About the PHP registration page, did not run to check whether user input meets the requirements of this step, ask the big God to point out where the error? What to do with it

Source: Internet
Author: User
About the PHP registration page, did not run to check whether user input meets the requirements of this step, ask the big God to point out where the error?
PHP Code
  
  User notes:

Please read the following terms carefully:

----------------

----Agreement content----

----------------

Agree not to agree

"; $str 2 =" "; Determines how the next process $msg =$_get["message" based on the value of the message; if (!isset ($msg)) $msg =$_post["message"]; if ($msg = = ' new ') {echo $str 1; Exit (); }elseif ($msg = = ' Agree ') {echo $str 2; Exit (); }elseif ($msg = = ' reg ') {//Check whether the user's input conforms to 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 fields cannot be empty! "; if ($password! = $repasswd) {echo ' password is not the same! "; }//Check the database for the presence of a user with the same name $conn = @mysql_connect ("localhost", "root", "") or Die ("failed-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 "User name already exists!"; }//user data is inserted into the database $sql = ' INSERT INTO member (username,password,userpassq,userpassa,email,telephone,addres s) VALUES ('. $_post[' username ']. ', '. $_post[' passwd ']. ', '. $_post[' PASSDP ']. ', '. $_post[' PASSDA ']. ', '. $_post[' em Ail ', ', '. $_post[' Tel ']. ', '. $_post[' addr ']. if (mysql_query ($sql)) {$sql 2= "SELECT id from Member WHERE username= ' $username '"; $result =mysql_query ($sql 2); $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 retry ")); Exit }}else{$msg =$_get["message"]; Echo $msg; Exit (); }}//page section?> <title>User Registration page</title>
  • Related Article

    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.