Registration verification has failed

Source: Internet
Author: User
Registration verification has failed
 Require_once ' db.php ';
Session_Start ();

$name = $_post["name"];
$mail = $_post["email"];
$pwd = $_post["Key"];
$pwd 2 = $_post["rekey"];
$agreement = $_post["agreement"];


if ($agreement = = "T") {
if ($pwd = = $pwd 2) {
$sql = "SELECT * from user";
$result = $db->query ($sql);
if ($result && $row = $result->fetch_assoc ()) {
if ($name = = $row ["name"]) {
Echo ' ";
Exit
}elseif ($mail = = $row ["Mail"]) {
Echo ' ";
Exit
}else{
$sql = "INSERT into user (Name,represent,pwd,mail,time) value (' {$name} ', 0, ' {$pwd} ', ' {$mail} ', now ())";
$result = $db->query ($sql);
if ($result && $db->affected_rows>0) {
$sql = "SELECT * from user where name= ' {$name} '";
$result = $db->query ($sql);
if ($result && $row = $result->fetch_assoc ()) {
$uid = $row [' uid '];
}
}
$result->free_result;
$db->close;

$sql = "INSERT into Userphoto (uid,name,type,url,size,time) value (' {$uid} ', ' Steve ', '. png ', './img/userphoto/steve.png ', ' 6.24kb ', Now ()) ";
$result = $db->query ($sql);
if ($result && $db->affected_rows>0) {
Echo ' ";
Exit
}else{
Echo ' ";
Exit
}
}
}
$result->free_result;
$db->close;
}else{
Echo ' ";
Exit
}
}else{
Echo ' ";
Exit
}
$result->free_result;
$db->close;
?>



The user already exists, this has been failed to verify, each registration of the same user name is successful, should be how to change?
------to solve the idea----------------------
$sql = "SELECT * from user";???
The result of this SQL execution, you know?
He will return all records in the user table, and you only take out the first record $row = $result->fetch_assoc ()
  • 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.