From f0e9cd804af6512529982e66f73a27fa7658c46c Mon Sep 17 00:00:00 2001 From: plegall Date: Sat, 18 Dec 2004 22:05:30 +0000 Subject: - bug fixed : in admin/cat_list, next_rank cant' be calculted and query to count sub-categories per sub-categories became false if no sub-categories - virtual association come back in admin/infos_images (not only in admin/picture_modify) - check_favorites function in admin section becomes check_user_favorites in public section : favorites are checked when user tries to display his favorites. Function was optimized. - in function update_category, wrap of long queries due to many categories to update at the same time - typo fixed in description of paginate_pages_around configuration parameter - bug fixed in new navigation bar : no separation pipe was displayed between next and last when the page displayed was the last - sessions.expiration changed of type from int to datetime (a lot easier to read) - sessions.ip removed : IP address is no longer used to verify session - $lang['cat_options'] was missing in en_UK.iso-8859-1 - typo fixed in language/en_UK.iso-8859-1/admin.lang.php on editcat_lock_info language item git-svn-id: http://piwigo.org/svn/trunk@647 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/user.inc.php | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'include/user.inc.php') diff --git a/include/user.inc.php b/include/user.inc.php index 3500ff186..eb5540f8b 100644 --- a/include/user.inc.php +++ b/include/user.inc.php @@ -59,7 +59,7 @@ if (isset($session_id) { $page['session_id'] = $session_id; $query = ' -SELECT user_id,expiration,ip +SELECT user_id,expiration,NOW() AS now FROM '.SESSIONS_TABLE.' WHERE id = \''.$page['session_id'].'\' ;'; @@ -67,22 +67,15 @@ SELECT user_id,expiration,ip if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); - if (!$user['has_cookie']) + if (strnatcmp($row['expiration'], $row['now']) < 0) { - if ($row['expiration'] < time()) - { - // deletion of the session from the database, - // because it is out-of-date - $delete_query = 'DELETE FROM '.SESSIONS_TABLE; - $delete_query.= " WHERE id = '".$page['session_id']."'"; - $delete_query.= ';'; - pwg_query($delete_query); - } - else if ($_SERVER['REMOTE_ADDR'] == $row['ip']) - { - $query_user .= ' WHERE id = '.$row['user_id']; - $query_done = true; - } + // deletion of the session from the database, because it is + // out-of-date + $delete_query = ' +DELETE FROM '.SESSIONS_TABLE.' + WHERE id = \''.$page['session_id'].'\' +;'; + pwg_query($delete_query); } else { -- cgit v1.2.3