我不知道该将filter_var ($ email_address, FILTER_VALIDATE_EMAIL)
放在此代码中的哪个位置?
$hiddenfield = md5("d-m-Y-l");
$passwordhash = '%_&!KJ:FLA)809-25j;LKJF:LKJAP*^@)';
$ww = hash('SHA512', md5(sha1('Test' . $passwordhash)));
if (isset($_POST['register'])) {
if (isset($_POST['hiddenfield']) == $hiddenfield) {
if (isset($_POST['username']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['password2'])) {
if (strlen($_POST['username']) >= 3) {
$email = $db->escape_string($_POST['email']);
if ($selectemail = $db->query("SELECT * FROM gebruikers WHERE email='$email'")) {
if ($selectemail->num_rows == 0) {
$ww1 = $db->escape_string($_POST['password']);
$ww2 = $db->escape_string($_POST['password2']);
if ($ww1 == $ww2) {
if (strlen($ww1) >= 6) {
$ip = $db->escape_string($_SERVER['REMOTE_ADDR']);
if ($ipc = $db->query("SELECT * FROM gebruikers WHERE ip='$ip'")) {
if ($ipc->num_rows < 3) {
$username = $db->escape_string(htmlentities($_POST['username']));
$passwordQ = $_POST['password'];
$password = $db->escape_string(hash('SHA512' , md5(sha1($passwordQ . $passwordhash))));
$email = $db->escape_string($_POST['email']);
$forgot_idf = substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()-ABCDEFGHIJKLMNOPQRSTUVWXYZ?><`~", 5)), 0, 25);
$active_code = $db->escape_string(md5($forgot_idf));
$register_on = date("F Y");
if ($insertregister = $db->query("INSERT INTO gebruikers (username, password, rankid, register_on, active, active_code, email, ip) VALUES ('$username','$password','1','$register_on', '0', '$active_code', '$email', '$ip')")) {
$error2 = 'Account is created!';
} else {
echo 'Query is incorrect! ' . $db->error;
}
} else {
$error = 'You have already registered more than 3 accounts!';
}
}
} else {
$error = 'Your password must be at least 6 characters!';
}
} else {
$error = 'The passwords do not match!';
}
} else {
$error = 'This email address has been used once before!';
}
} else {
echo 'Query is incorrect! ' . $db->error;
}
} else {
$error = 'Your username must contain at least 3 letters!';
}
}
}
}
我已经尝试了一切。
有人可以添加filter_var ($ email_address, FILTER_VALIDATE_EMAIL)
吗?