dumb question -- i'm trying to troubleshoot a third-party plugin (chat) that integrates with XF's login/sessions, as it should automatically log in any user that has an established XF session.
The problem i'm having is this -- i'm using memcached as a back-end cache, and from what I can tell that means it is caching sessions in memory (the table xf_session is blank)
Unfortunately, some code in the add-on looks like this:
It is trying to query the database to get the session data, and failing b/c it finds nothing there.
What's the proper way to do this when sessions are being cached?
thanks!
The problem i'm having is this -- i'm using memcached as a back-end cache, and from what I can tell that means it is caching sessions in memory (the table xf_session is blank)
Unfortunately, some code in the add-on looks like this:
Code:
if (!empty($_COOKIE['xf_session'])) {
$sql = ("SELECT `session_data` FROM `".TABLE_PREFIX."session` WHERE `session_id` = '".$_COOKIE['xf_session']."'"); $query = mysqli_query($GLOBALS['dbh'],$sql);
$sess2 = mysqli_fetch_assoc($query);
$sess3 = unserialize($sess2['session_data']);
if(!empty($sess3['user_id'])) {
$userid = $sess3['user_id'];
} else {
$userid = 0;
}
}
It is trying to query the database to get the session data, and failing b/c it finds nothing there.
What's the proper way to do this when sessions are being cached?
thanks!