aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_session.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-04-14 22:15:24 +0000
committerrvelices <rv-github@modusoptimus.com>2006-04-14 22:15:24 +0000
commit18570279efdbdfd171e16d9948175fb0b959546a (patch)
tree1230f3f001bdd0763150cc53c20824fb191d5e61 /include/functions_session.inc.php
parente1c0fd7f4c76ae6c343b21dcf904ad4ef0b87ece (diff)
merge r1175 from branch-1_6 into trunk
fix: sessions css 3px image border goes from both clear and dark to image.css git-svn-id: http://piwigo.org/svn/trunk@1176 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_session.inc.php')
-rw-r--r--include/functions_session.inc.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php
index f2533d1d1..96508a923 100644
--- a/include/functions_session.inc.php
+++ b/include/functions_session.inc.php
@@ -165,14 +165,25 @@ UPDATE '.SESSIONS_TABLE.'
WHERE id = \''.$session_id.'\'
;';
pwg_query($query);
- if ( mysql_affected_rows()==-1 )
- {
+ if ( mysql_affected_rows()==0 )
+ { // 2 possible cases:
+ //- the user has just login so we need to insert
+ //- the user went through 2 pages very fast (in the same second), so
+ // data and expiration are the same as before
$query = '
+SELECT id FROM '.SESSIONS_TABLE.'
+ WHERE id = \''.$session_id.'\'
+;';
+ $id = array_from_query( $query, array('id') );
+ if ( empty($id) )
+ {
+ $query = '
INSERT INTO '.SESSIONS_TABLE.'
(id,data,expiration)
VALUES(\''.$session_id.'\',\''.$data.'\',now())
;';
- pwg_query($query);
+ pwg_query($query);
+ }
}
return true;
}