Example #1
0
function ShowErrorPage($code, $description, $notice)
{
    global $user, $data;
    header('HTTP/1.1 ' . $code . ' ' . $description);
    header('status: ' . $code . ' ' . $description);
    if (isset($notice)) {
        $data['title'] = $code . ' ' . $description;
        $data['description'] = $notice;
        ShowTemplatePage("_error");
    }
    exit;
}
Example #2
0
function OnActionLogin()
{
    global $user, $data, $db;
    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        ShowTemplatePage("login");
    } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $email = GetStrParam('email', $_POST, MIN_EMAIL_LENGTH, MAX_EMAIL_LENGTH);
        $password = GetStrParam('password', $_POST, MIN_PASSWORD_LENGTH, MAX_PASSWORD_LENGTH);
        if (strlen($email) > 0 && strlen($password) > 0) {
            $ret['ret'] = $user->Login($email, $password);
        } else {
            $ret['ret'] = false;
        }
        _json_encode($ret);
    }
}