login system fixes (3)

This commit is contained in:
Andrew Dolgov 2007-03-01 13:57:31 +01:00
parent e672099651
commit a885f0ec2a
6 changed files with 22 additions and 8 deletions

View file

@ -1168,14 +1168,15 @@
}
}
if ($_SESSION["cookie_lifetime"] && $_SESSION["uid"]) {
/* if ($_SESSION["cookie_lifetime"] && $_SESSION["uid"]) {
//print_r($_SESSION);
if (time() > $_SESSION["cookie_lifetime"]) {
return false;
}
}
} */
return true;
}
@ -1190,6 +1191,10 @@
}
}
if ($_COOKIE["ttrss_sid"]) {
require_once "sessions.php";
}
if (!validate_session($link)) {
logout_user();
render_login_form($link);
@ -1204,13 +1209,21 @@
$password = $_POST["password"];
$remember_me = $_POST["remember_me"];
if ($remember_me) {
session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER);
} else {
session_set_cookie_params(SESSION_COOKIE_LIFETIME);
}
require_once "sessions.php";
if (authenticate_user($link, $login, $password)) {
$_POST["password"] = "";
if ($remember_me) {
$_SESSION["cookie_lifetime"] = time() +
SESSION_COOKIE_LIFETIME_REMEMBER;
} else if (SESSION_COOKIE_LIFETIME > 0) {
} else if (SESSION_COOKIE_LIFETIME) {
$_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME;
}
@ -1230,6 +1243,7 @@
}
} else {
require_once "sessions.php";
return authenticate_user($link, "admin", null);
}
}

View file

@ -1,5 +1,5 @@
<?php
require_once "sessions.php";
// require_once "sessions.php";
require_once "sanity_check.php";
require_once "functions.php";
require_once "config.php";

View file

@ -1,6 +1,6 @@
<?php
require_once "functions.php";
require_once "sessions.php";
// require_once "sessions.php";
require_once "sanity_check.php";
require_once "version.php";
require_once "config.php";

View file

@ -95,7 +95,7 @@
session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
}
session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER);
// session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER);
session_start();
?>

View file

@ -1,6 +1,6 @@
<?php
require_once "functions.php";
require_once "sessions.php";
// require_once "sessions.php";
require_once "sanity_check.php";
require_once "version.php";
require_once "config.php";

View file

@ -1,5 +1,5 @@
<?php
require_once "sessions.php";
// require_once "sessions.php";
require_once "sanity_check.php";
require_once "functions.php";