} else { if ($email) { $ERRORS->Add('Incorrent E-Mail address. Please make sure you enter the correct E-Mail address of the account.'); } } unset($res); //Check for errors $ERRORS->Check('/index.php?page=password_recovery'); #################################################################### ## The actual script begins here //assume failure $success = false; //Let's setup our token $token = new Tokens(); //Set the account ID to be included as salt $token->setIdentifier($row[$columns['id']]); //Set the application string so the token is only valid for this app $token->setApplication('PRECOVER'); //Set the token expiration time $token->setExpiration($emailTokenLifetime); //Save the user ID under the token $token->setExternalData($row); //Generate a key for the token $token->generateKey(); //get the encoded key $key = $token->get_encodedToken(); //register the token $tokenReg = $token->registerToken(); //continue only if the key was successfully registered if ($tokenReg === true) { //update the account event