示例#1
0
文件: reset.php 项目: uakfdotb/oneapp
 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
         $inform["success"] = "Details on how to reset your password have been sent to " . $_REQUEST['email'] . "!";
     } else {
         if ($result == 1) {
             $inform["error"] = "No user found with the information provided!";
         } else {
             if ($result == 2) {
                 $inform["warn"] = "A reset request has been recently sent. Check your email and find those details or wait for the current reset request to expire.";
             }
         }
     }
     get_page("reset_form", array("inform" => $inform));
 }
示例#2
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'])) {
    get_page("message", array("title" => "Logged In", "message" => "You are already logged in! Click <a href=\"application/\">here</a> to continue."));
} else {
    if (isset($_REQUEST['email'])) {
        $result = resetRequest('', $_REQUEST['email'], false);
        //false to specify we are asking for username
        if ($result == 0) {
            //request successful
            get_page("message", array("title" => "Check your email", "message" => "Your username has been sent to the email address provided."));
        } else {
            if ($result == 1) {
                get_page("message", array("title" => "Error", "message" => "No user found with that email address!"));
            } else {
                if ($result == 2) {
                    get_page("message", array("title" => "Error", "message" => "A reset request has been recently sent. Check your email and find those details or wait for the current reset request to expire."));
                } else {
                    if ($result == 3) {
                        get_page("message", array("title" => "Error", "message" => "You have been temporarily locked out. Please try again later."));
                    }
                }
            }
        }
    } else {
        get_page("forgotusername");