Please open bridge/coppermine.inc.php, and replace the whole function session_extraction with
function session_extraction()
{
global $CONFIG;
$superCage = Inspekt::makeSuperCage();
// Default anonymous values
$id = 0;
$pass = '';
// Get the session cookie value
$sessioncookie = $superCage->cookie->getEscaped($this->client_id);
// Create the session id by concat(session_cookie_value, client_id)
$session_id = $sessioncookie.$this->client_id;
// Lifetime of 'remember me' session is 2 weeks
$rememberme_life_time = time()-(CPG_WEEK*2);
// Lifetime of normal session is 1 hour
$session_life_time = time()-CPG_HOUR;
// Clean up old sessions every 5 minutes at maximum
if ($CONFIG['session_cleanup'] < time() - 300) {
// Delete old sessions
$sql = "DELETE FROM {$this->sessionstable} WHERE time < $session_life_time AND remember = 0";
cpg_db_query($sql, $this->link_id);
// Delete stale 'remember me' sessions
$sql = "DELETE FROM {$this->sessionstable} WHERE time < $rememberme_life_time";
cpg_db_query($sql, $this->link_id);
// Update database entry
$sql = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value = ".time()." WHERE name = 'session_cleanup'";
cpg_db_query($sql, $this->link_id);
}
$step = 0;
// Check for valid session if session_cookie_value exists
if ($sessioncookie) {
$step = 1;
// Check for valid session
$sql = "SELECT user_id, time FROM {$this->sessionstable} WHERE session_id = '" . md5($session_id) . "'";
$result = cpg_db_query($sql);
// If session exists...
if (mysql_num_rows($result)) {
$step = 2;
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
$row['user_id'] = (int) $row['user_id'];
$this->sessiontime = $row['time'];
// Check if there's a user for this session
$sql = "SELECT user_id, user_password FROM {$this->usertable} WHERE user_id = {$row['user_id']}";
$result = cpg_db_query($sql, $this->link_id);
// If user exists, use the current session
if ($result) {
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
$pass = $row['user_password'];
$id = (int) $row['user_id'];
$this->session_id = $sessioncookie;
// If the user doesn't exist, use default guest credentials
}
// If not a valid session exists, create a new session
} else {
$this->create_session();
}
// No session exists; create one
} else {
$this->create_session();
}
if ($step == 0) echo "<span style=\"color:red; font-weight: bold;\">No session cookie found for this client id (".$this->client_id.")! [code 1]</span>";
if ($step == 1) echo "<span style=\"color:red; font-weight: bold;\">Session cookie exists, but found no matching session in the database! [code 2]</span>";
return ($id) ? array($id, $pass) : false;
}
It just adds some debug output to the top of your page if no session cookie exists or if the stored session doesn't match a session stored in the database. Please have a look which message will be displayed immediately when you're logged out from your gallery. Don't refresh the page, as Coppermine will automatically create the new session and the error messages won't be displayed again (until you'll be logged out again).