I've sent this link to a user's email:
http://www.example.com/redefinir_senha.php?token=4kl_EIwmivsCg52TsBgWWgWMPsApjFTJL8oBUXPDoHE&uid=USER-ID
On the redefine_password.php page I know how to do the following:
$token= $_GET['token'];
The business is that before using the "token" to update the password with my DBUpdate function I need to get the new password of the form that is on this page also through the POST method.
I have used GET before and within that IF below, but in the end the password is not changed in the database.
if ($_SERVER["REQUEST_METHOD"] == "POST"){
$token = $_GET['token']; // Já coloquei aqui e fora, já tentei usar sessão
// ao invés de simples variável e nada...
if (isset($_POST['senha'])){$senha = DBEscape($_POST['senha']);
$ativar = array('senha' => $senha);
$atualiza = DBUpdate('myway', $ativar, "token = '$token'");
if ($atualiza==true){
echo "Senha redefinida com sucesso!";
}
} else {
echo "Ocorreu um erro, entre em contato conosco!<br>";
}
}
It's not a problem with the update function because I'm using it on another page and it works fine.