PHP registration page Verification Code, do not know where there are errors, each submission even if the verification code wrong, incredibly can also successfully submitted.
The following is the registration page of all the code, each time the verification code submitted, whether the input is correct or error, the content will be successfully submitted. Find out where the code is wrong.
if (!function_exists ("getsqlvaluestring")) {
function getsqlvaluestring ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (Php_version < 6) {
$theValue = GET_MAGIC_QUOTES_GPC ()? Stripslashes ($theValue): $theValue;
}
$theValue = function_exists ("mysql_real_escape_string")? Mysql_real_escape_string ($theValue): mysql_escape_string ($theValue);
Switch ($theType) {
Case "Text":
$theValue = ($theValue! = "")? "". $theValue. "'": "NULL";
Break
Case "Long":
Case "int":
$theValue = ($theValue! = "")? Intval ($theValue): "NULL";
Break
Case "Double":
$theValue = ($theValue! = "")? Doubleval ($theValue): "NULL";
Break
Case "Date":
$theValue = ($theValue! = "")? "". $theValue. "'": "NULL";
Break
Case "defined":
$theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;
Break
}
return $theValue;
}
}
$editFormAction = $_server[' php_self ');
if (Isset ($_server[' query_string ')) {
$editFormAction. = "?". Htmlentities ($_server[' query_string ');
}
if ((Isset ($_post["Mm_insert")) && ($_post["mm_insert"] = = "Form1") {
$insertSQL = sprintf ("INSERT into USER_ZC (username, pass, phonenumber, realname, Sex) VALUES (%s,%s,%s,%s,%s)",
Getsqlvaluestring ($_post[' username '), "text"),
Getsqlvaluestring ($_post[' Pass '), "text"),
Getsqlvaluestring ($_post[' PhoneNumber '), "int"),
Getsqlvaluestring ($_post[' realname '), "text"),
Getsqlvaluestring ($_post[' select '], "text"));
if ($_post[' Yzm ']!== $_session["Vocode"]) {
Header ("Location:". ") User_zcsb.php ");
}
mysql_select_db ($database _conn, $conn);
$Result 1 = mysql_query ($insertSQL, $conn) or Die (Mysql_error ());
$insertGoTo = "user_zccg.php";
if (Isset ($_server[' query_string ')) {
$insertGoTo. = (Strpos ($insertGoTo, '? '))? "&": "?";
$insertGoTo. = $_server[' query_string ');
}
Header (sprintf ("Location:%s", $insertGoTo));
}
?>
<title>User Registration</title>
| Member account Registration |
| * User Name |