fixed some of our sessions problems:

- [ 1015846 ] Registering session MySQL query error
- handlich of timed out sessions for php4 sessions was wrong
==> I can't reproduce any more sessions probs, either with db nor php4 sessions
This commit is contained in:
Ralf Becker 2004-08-27 13:17:25 +00:00
parent 66d2519243
commit d868007dac
3 changed files with 10 additions and 7 deletions

View File

@ -278,7 +278,7 @@
*/ */
if ($session['session_dla'] <= (time() - $GLOBALS['phpgw_info']['server']['sessions_timeout'])) if ($session['session_dla'] <= (time() - $GLOBALS['phpgw_info']['server']['sessions_timeout']))
{ {
$this->clean_sessions(); $this->destroy($sessionid,$kp3);
return False; return False;
} }

View File

@ -59,7 +59,7 @@
function register_session($login,$user_ip,$now,$session_flags) function register_session($login,$user_ip,$now,$session_flags)
{ {
$GLOBALS['phpgw']->db->query("DELETE FROM phpgw_sessions WHERE session_id='$this->sessionsid'",__LINE__,__FILE__); $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_sessions WHERE session_id='$this->sessionid'",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->query("INSERT INTO phpgw_sessions VALUES ('" . $this->sessionid $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_sessions VALUES ('" . $this->sessionid
. "','".$login."','" . $user_ip . "','" . "','".$login."','" . $user_ip . "','"

View File

@ -105,7 +105,7 @@
function destroy($sessionid, $kp3) function destroy($sessionid, $kp3)
{ {
if (! $sessionid && $kp3) if (!$sessionid && $kp3)
{ {
return False; return False;
} }
@ -115,8 +115,8 @@
// Only do the following, if where working with the current user // Only do the following, if where working with the current user
if ($sessionid == $GLOBALS['phpgw_info']['user']['sessionid']) if ($sessionid == $GLOBALS['phpgw_info']['user']['sessionid'])
{ {
$this->clean_sessions();
session_unset(); session_unset();
//echo "<p>sessions_php4::destroy: session_destroy() returned ".(session_destroy() ? 'True' : 'False')."</p>\n";
session_destroy(); session_destroy();
if ($GLOBALS['phpgw_info']['server']['usecookies']) if ($GLOBALS['phpgw_info']['server']['usecookies'])
{ {
@ -235,9 +235,12 @@
{ {
continue; // happens if webserver runs multiple user-ids continue; // happens if webserver runs multiple user-ids
} }
$fd = fopen ($path . '/' . $file,'r'); $session = '';
$session = fread ($fd, filesize ($path . '/' . $file)); if (($fd = fopen ($path . '/' . $file,'r')))
fclose ($fd); {
$session = ($size = filesize ($path . '/' . $file)) ? fread ($fd, $size) : 0;
fclose ($fd);
}
if (substr($session,0,14) != 'phpgw_session|') if (substr($session,0,14) != 'phpgw_session|')
{ {
continue; continue;