bug 308: improve correction
svn merge -r1190:1191 from branch1_6 into trunk git-svn-id: http://piwigo.org/svn/trunk@1192 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
790bf47d59
commit
efc05de9d4
1 changed files with 6 additions and 16 deletions
|
|
@ -165,26 +165,16 @@ UPDATE '.SESSIONS_TABLE.'
|
||||||
WHERE id = \''.$session_id.'\'
|
WHERE id = \''.$session_id.'\'
|
||||||
;';
|
;';
|
||||||
pwg_query($query);
|
pwg_query($query);
|
||||||
if ( mysql_affected_rows()==0 )
|
if ( mysql_affected_rows()>0 )
|
||||||
{ // 2 possible cases:
|
{
|
||||||
//- the user has just login so we need to insert
|
return true;
|
||||||
//- the user went through 2 pages very fast (in the same second), so
|
}
|
||||||
// data and expiration are the same as before
|
$query = '
|
||||||
$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.'
|
INSERT INTO '.SESSIONS_TABLE.'
|
||||||
(id,data,expiration)
|
(id,data,expiration)
|
||||||
VALUES(\''.$session_id.'\',\''.$data.'\',now())
|
VALUES(\''.$session_id.'\',\''.$data.'\',now())
|
||||||
;';
|
;';
|
||||||
pwg_query($query);
|
pwg_query($query);
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue