if (isset($_COOKIE['temp_access_code'])) {
if (!isset($_GET['email']) && !isset($_GET['code'])) {
header("location:index.php");
} else {
if (empty($_GET['email']) || empty($_GET['code'])) {
header("location:index.php");
} else {
if (isset($_POST['code'])) {
$email = htmlentities($_GET['email']);
$validation_code = htmlentities($_POST['code']);
$sql = "SELECT userID FROM `users` WHERE identifier = '".$link->real_escape_string($validation_code)."' AND email = '".$link->real_escape_string($email)."' LIMIT 1";
$result = $link->query($sql);
if ($result->num_rows == 1 && $validation_code == $_GET['code']){
header("location:reset.php");
} else {
echo "Sorry, incorrect validation code.";
}
}
}
}
}
else {
//your cookie expired
header("location:recover.php");
}
ASKER
if (isset($_COOKIE['temp_access_code'])) {
if (!isset($_GET['email']) && !isset($_GET['code'])) {
header("location:index.php");
} else {
if (empty($_GET['email']) || empty($_GET['code'])) {
header("location:index.php");
} else {
if (isset($_POST['code'])) {
$email = htmlentities($_GET['email']);
$validation_code = htmlentities($_GET['code']);
$sql = "SELECT userID FROM `users` WHERE identifier = '".$link->real_escape_string($_POST['code'])."' AND email = '".$link->real_escape_string($email)."' LIMIT 1";
$result = $link->query($sql);
if ($result->num_rows == 1 && $validation_code == $_POST['code']){
header("location:reset.php");
} else {
echo "Sorry, incorrect validation code.";
}
}
}
}
}
ASKER
$email = htmlentities($_GET['email']);
$validation_code = htmlentities($_GET['code']);
ASKER
ASKER
ASKER
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
...
>$validation_code = htmlentities($_POST['code']);
You can't use $_POST on a get request. A request can only be one of get or post. The rest of it looks ok.
Bye, Olaf.