Exemplo n.º 1
0
<?php

//calls the class and run forgetPassword function with values obtained by post
include 'class/class.ForgetPassword.php';
$userLogin = $_POST['userLogin'];
$userCPF = $_POST['userCPF'];
if (forgetPassword($userLogin, $userCPF) == true) {
    $return = true;
} else {
    $return = false;
}
    }
    //Check request url is https or not
    if (!empty($_SERVER["HTTPS"])) {
        if ($_SERVER["HTTPS"] !== "off") {
            $EMAILID = $rm->cleanData(trim($_POST['emailId']));
            if ($EMAILID == "") {
                $result = $rm->fields_validation();
                return $result;
            } else {
                $checkEmail = $rm->checkUNEmail($EMAILID);
                if ($checkEmail['status'] == false) {
                    $result = $rm->emailNotAvailable();
                    return $result;
                } else {
                    //print_r($checkEmail);
                    //die();
                    $result = $rm->sendPasswordEmail($checkEmail['user_id']);
                    return $result;
                }
            }
        } else {
            $result = $rm->ssl_error();
            return $result;
        }
    } else {
        $result = $rm->ssl_error();
        return $result;
    }
}
echo forgetPassword();
Exemplo n.º 3
0
function coreUserAction($vCodeCorrect = true)
{
    global $CoreUserPasswordSecret, $CoreUserPasswordColumn;
    checkRequireField(array("Action"));
    $action = post("Action");
    if ($action == "SignUp") {
        if ($vCodeCorrect === false) {
            printResultByMessage(getLanguageString("VCodeError"), 105);
        }
        $userName = post("UserName");
        $email = post("Email");
        $phoneNumber = post("PhoneNumber");
        $password = post("Password");
        $emailOrPhoneNumber = post("EmailOrPhoneNumber");
        if ($emailOrPhoneNumber) {
            if (is_numeric($emailOrPhoneNumber)) {
                $phoneNumber = $emailOrPhoneNumber;
            }
            if (filter_var($emailOrPhoneNumber, FILTER_VALIDATE_EMAIL)) {
                $email = $emailOrPhoneNumber;
            }
        }
        $errorMessage = signUp($userName, $email, $phoneNumber, $password);
        if ($errorMessage) {
            if (function_exists("signupErrorOverride")) {
                signupErrorOverride($errorMessage);
            } else {
                printResultByMessage($errorMessage, 104);
            }
        } else {
            if (function_exists("signupOverride")) {
                signupOverride(getCoreUserInfo());
            } else {
                printCoreUserInfo();
            }
        }
    } else {
        if ($action == "Login") {
            if ($vCodeCorrect === false) {
                printResultByMessage(getLanguageString("VCodeError"), 105);
            }
            $usernameEmailPhoneNumber = post("UserNameOrEmailOrPhoneNumber");
            $password = post("Password");
            if (checkLogin($usernameEmailPhoneNumber, $password)) {
                if (function_exists("loginOverride")) {
                    loginOverride(getCoreUserInfo());
                } else {
                    printCoreUserInfo();
                }
            } else {
                if (function_exists("loginFailOverride")) {
                    loginFailOverride(getLanguageString("LoginFail"));
                } else {
                    printResultByMessage(getLanguageString("LoginFail"), 103);
                }
            }
        } else {
            if ($action == "ChangePassword") {
                if (!session("Uid")) {
                    printResultByMessage(getLanguageString("ChangePasswordFail"), 107);
                }
                $oldPassword = md5(post("OldPassword") . $CoreUserPasswordSecret);
                $newPassword = md5(post("NewPassword") . $CoreUserPasswordSecret);
                $errorMessage = changePassword(session("Uid"), $oldPassword, $newPassword);
                if ($errorMessage) {
                    printResultByMessage($errorMessage, 107);
                } else {
                    printResultByMessage("", 0);
                }
                //click find password
            } else {
                if ($action == "ForgetPassword") {
                    forgetPassword();
                } else {
                    if ($action == "ResetPassword") {
                        if (!session("ResetPasswordUid")) {
                            printResultByMessage(getLanguageString("ChangePasswordFail"), 106);
                        }
                        if (strlen(post("NewPassword")) < 5) {
                            printResultByMessage(getLanguageString("PasswordTooShort"), 106);
                        }
                        $newPassword = md5(post("NewPassword") . $CoreUserPasswordSecret);
                        $coreUserLink = connetCoreUserDB();
                        mysqli_query($coreUserLink, "update User set {$CoreUserPasswordColumn}='{$newPassword}' where Uid=" . session("ResetPasswordUid"));
                        mysqli_query($coreUserLink, "delete from ForgetPassword where Uid = " . session("ResetPasswordUid"));
                        if (mysql_error()) {
                            printResultByMessage($errorMessage, 106);
                        } else {
                            printResultByMessage("", 0);
                        }
                    }
                }
            }
        }
    }
}