I don't know if this can help you but here is what I found:
the reason that this error happens is becuase of this "if" statement (in catalog/includes/modules/phpbb2/includes/sessions.php) right here:
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
for some reason the update query works fine if you are logged on but "!$db->sql_affectedrows()" doesn't think that you updated anything.
so what i did to fix this is:
changed the original code: (approx line 73 to line 82) of
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $thispage_id, $login)";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql);
}
}
to this new code:
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $thispage_id, $login)";
if ( !$db->sql_query($sql) )
{
// delete session that is the same
$sql = "DELETE FROM phpbb_sessions WHERE session_id = \"$session_id\"";
$db->sql_query($sql);
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $thispage_id, $login)";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql);
}
}
}
what this does is check to see if there is a session that exists in the phpbb_sessions table. if so then it deletes it from this table. Then it tries to do the insert again. If you get another insert problem you get the critical error. If not then we are fine.
Though there is a 1 in 6.3340286662973277706162286946812e+49 chance that the session id may be recreated again while someone is logged in at that same time I assume it will boot the other person off becuase it deletes their session (but since I am a gambler I am willing to take that chance). In the off chance that this does happen I am assuming since the session table contains the session_user_id number this should reduce any risk of anything else funny happening. Finally if someone does encounter something weird while they are using the bbs (that is they are getting kicked off becuase of their session id) and they actually do contact the webmaster. just tell them to clear their cookies and a new session id will be created when they log in.
I have worked with oscommerce for a while now but have not worked with phpbb. So if there are any flaws with my programming or any comments, please feel free to post a reply so I can fix my code. Anyway I hope this helps all those who use this contribution.