diff options
author | Andrew Dolgov <[email protected]> | 2007-03-01 13:09:05 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-03-01 13:09:05 +0100 |
commit | d620cfe70afc35bae4f8c2d92798448812701554 (patch) | |
tree | 37e11268a3d5589d30f32cf332c8922d5be9f69c /functions.php | |
parent | 64f6db9051ea25293077e0ebcb61f90ec7eb72e9 (diff) |
login system fixes
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/functions.php b/functions.php index 170696352..59086506a 100644 --- a/functions.php +++ b/functions.php @@ -1167,6 +1167,15 @@ } } } + + if ($_SESSION["cookie_lifetime"] && $_SESSION["uid"]) { + +# print time() . " vs " . $_SESSION["cookie_lifetime"]; + + if (time() > $_SESSION["cookie_lifetime"]) { + return false; + } + } return true; } @@ -1193,9 +1202,24 @@ if ($login_action == "do_login") { $login = $_POST["login"]; $password = $_POST["password"]; + $remember_me = $_POST["remember_me"]; if (authenticate_user($link, $login, $password)) { $_POST["password"] = ""; + + if ($remember_me) { + $_SESSION["cookie_lifetime"] = time() + + SESSION_COOKIE_LIFETIME_REMEMBER; + } else { + $_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME; + } + + setcookie("ttrss_cltime", $_SESSION["cookie_lifetime"], + $_SESSION["cookie_lifetime"]); + + header("Location: " . $_SERVER["REQUEST_URI"]); + exit; + return; } } @@ -1204,6 +1228,7 @@ render_login_form($link); exit; } + } else { return authenticate_user($link, "admin", null); } |