Ejemplo n.º 1
0
<?php

include "include/common.php";
include "config.php";
include "include/db_connect.php";
include "include/session.php";
include "include/reset.php";
if (isset($_SESSION['user_id'])) {
    $inform["info"] = "You are already logged in!";
    get_page("reset", array("message" => "<a href=\"application/\">Click here</a> if you are not redirected.", "redirect" => "application/"));
} else {
    if (isset($_REQUEST['username']) && isset($_REQUEST['email'])) {
        if (isset($_REQUEST['auth']) && isset($_REQUEST['user_id'])) {
            $check = resetCheck($_REQUEST['username'], $_REQUEST['email'], $_REQUEST['auth'], $_REQUEST['user_id']);
            if (isset($_REQUEST['password']) && isset($_REQUEST['password_confirm'])) {
                if ($_REQUEST['password'] == $_REQUEST['password_confirm']) {
                    resetPassword($_REQUEST['user_id'], $_REQUEST['password']);
                    $inform["success"] = "Your password has been reset! Log in now!";
                    get_page("login", array("inform" => $inform));
                } else {
                    $inform["error"] = "The passwords do not match!";
                    get_page("reset", array("inform" => $inform));
                }
            } else {
                get_page("reset_password", array("username" => $_REQUEST['username'], "email" => $_REQUEST['email'], "auth" => $_REQUEST['auth'], "user_id" => $_REQUEST['user_id']));
            }
        } else {
            $result = resetRequest($_REQUEST['username'], $_REQUEST['email']);
            $inform = array();
            if ($result == 0) {
                //request successful
Ejemplo n.º 2
0
            if (strtotime('200 minutes', $ts[0]) < strtotime('now')) {
                echo '<br>Auto sent Email with new token and please check your email box<br>';
                newToken($userID, $email, $SafeForUse);
            } else {
                if ($ts[0] !== 0 && $ts[0] !== false && !empty($ts[0])) {
                    echo '<br>Token Received<br>';
                } else {
                    newToken($userID, $email, $SafeForUse);
                }
            }
            $gToken = ctype_alnum(filter_input(INPUT_GET, 'token'));
            if ($gToken === false) {
                $gToken = ctype_alnum(filter_input(INPUT_POST, 'token'));
            }
            if ($gToken !== false) {
                if (strlen(filter_input(INPUT_GET, 'token')) === 35) {
                    resetCheck($userID, filter_input(INPUT_GET, 'token'), $email, $SafeForUse);
                } else {
                    resetForm($email);
                }
            }
            resetForm($email);
        } else {
            resetForm($email);
        }
    } else {
        newToken($userID, $email, $SafeForUse);
    }
} else {
    echo ' user id Not Found';
}