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

View File

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

View File

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

View File

@ -95,7 +95,7 @@
session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); 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(); session_start();
?> ?>

View File

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

View File

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