<?php include_once 'auth_connect.php'; include_once 'functions.php'; sec_session_start(); // Our custom secure way of starting a PHP session. if (isset($_POST['username'])) { $email = $_POST['username']; // Login successfull $compl = recover_password($email, $mysqli); if ($compl == true) { echo true; } else { if ($compl == "recovery_pending") { // Recovery pending echo 0; } else { // Incorrect values sent echo false; } } } else { // The correct POST variables were not sent to this page. echo false; }
function start_password_recovery($connection, $clean_email) { switch (recover_password($connection, $clean_email)) { case 1: //echo "Success! Password has been reset, email has been sent!"; break; case -1: //echo "Error in sending email, but password has been reset"; break; case -2: //echo "Error in changing the password"; break; default: echo "Something is seriously broken"; } }