Beispiel #1
0
function check_login()
{
    global $cookie, $option;
    if (!(isset($_COOKIE[COOKIE_PR . "user"]) && $_COOKIE[COOKIE_PR . "user"] != NULL && isset($_COOKIE[COOKIE_PR . 'pwd']))) {
        $GLOBALS['user']['login'] = FALSE;
        return FALSE;
    }
    $cookie = new mycookies($_COOKIE[COOKIE_PR . 'user'], $option->arr['cookie_key'], TRUE);
    $cookie->Verification($_COOKIE[COOKIE_PR . 'pwd'], $option->arr['cookie_time']);
    if ($cookie->ver) {
        $GLOBALS['user']['login'] = TRUE;
    } else {
        $GLOBALS['user']['login'] = FALSE;
    }
    return $GLOBALS['user']['login'];
}
Beispiel #2
0
if (isset($_GET['url'])) {
    $url = "&url=" . $_GET['url'];
}
$url = NULL;
if (!(isset($_POST['user']) && $_POST['user'] != NULL)) {
    die(html_jump("./login.php?err=用户名不能为空" . $url));
}
if (!(isset($_POST['pwd']) && $_POST['pwd'] != NULL)) {
    die(html_jump("./login.php?err=密码不能为空" . $url));
}
if (!(isset($_POST['save']) && $_POST['save'] == 1)) {
    $_POST['save'] = 0;
}
$login = new password($_POST['user'], $_POST['pwd']);
if (!$login->mysql_pwd()) {
    die(html_jump("./login.php?err=密码错误" . $url));
}
if (!$GLOBALS['user']['active']) {
    die(html_jump("./login.php?err=账户被禁止" . $url));
}
$cookie = new mycookies($GLOBALS['user']['user'], $option->arr['cookie_key'], NULL);
$cookie->new_cookie();
$cookie->set($_POST['save'] * $option->arr['cookie_time'] * 60 * 60);
if (!$cookie->up_data()) {
    die(html_jump("./login.php?err=登陆错误") . $url);
} else {
    if (isset($_GET['url'])) {
        die(html_jump(urldecode($_GET['url'])));
    }
    die(html_jump("./index.php"));
}