Added external_fud_session_status($str) to forum_login.php [message #34996] |
Fri, 01 December 2006 03:15 |
rcwjenks
Messages: 3 Registered: November 2006
Karma: 0
|
Junior Member |
|
|
I've recently installed FUD and integrated it into my existing PHP based site. I use my site's login to login to both the forum and my site. I'm using the scripts/forum_login.php to accomplish this. I found (at least) two difficiencies in this approach:
1) If the user logged in to my site and did not navigate to the forums, the user would not be considered "online" (to FUD) after a short period of time. I wanted to use FUD's online list for both.
2) If another user went to the really cool "show what people are doing" page, it wouldn't show what they were doing outside the forums.
To fix this, I added the following function to forum_login.php and I call this on every page on my site. I pass in a str values indicating where they are. It seems to work fine.
Is this code the correct way to do this?
If this would be useful to other, you're welcome to include this code in the product without crediting me. I release all rights.
function external_fud_session_status($str=null)
{
__fud_login_common(1);
$ses_id = $_COOKIE[$GLOBALS['COOKIE_NAME']];
if (!empty($ses_id)) {
$sys_id = __ses_make_sysid(($GLOBALS['FUD_OPT_2'] & 256), ($GLOBALS['FUD_OPT_3'] & 16));
q('UPDATE fud26_ses SET sys_id=\''.$sys_id.'\', time_sec='.__request_timestamp__.', action='.($str ? _esc($str) : 'NULL').' WHERE ses_id=\''.$ses_id.'\'');
}
}
|
|
|
|
|