Exemplo n.º 1
0
                            break;
                        }
                    }
                }
            } else {
                if ($item["Type"] == "DropListFromTable") {
                    $formTable = $item["FromTable"];
                    $fromTableResult = getData("select " . $formTable["IdField"] . " from " . $formTable["TableName"] . " where " . $formTable["DisplayField"] . " like '%{$searchValue}%'");
                    $condition = "where {$searchKey} in (";
                    foreach ($fromTableResult as $v) {
                        $condition .= $v[$formTable["IdField"]] . ",";
                    }
                    $condition .= "'')";
                } else {
                    if ($item["Type"] == "AngellechoId") {
                        $coreUserLink = connetCoreUserDB();
                        $rs = mysqli_query($coreUserLink, "select Uid from User where UserName like '%{$searchValue}%'");
                        $condition = "where {$searchKey} in (";
                        while ($d = mysqli_fetch_array($rs)) {
                            $condition .= $d['Uid'] . ",";
                        }
                        $condition .= "'')";
                    } else {
                        $condition = "where {$searchKey} like '%" . addslashes($searchValue) . "%'";
                    }
                }
            }
            break;
        }
    }
}
Exemplo n.º 2
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);
                        }
                    }
                }
            }
        }
    }
}