Topic awaiting preservation: forum based php question |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: Kansas City, MO , USA |
posted 11-05-2006 08:13
i am in the middle of making an online community setup... i recently started taking on the forum part of it... |
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 11-05-2006 14:38
Well, here at the Asylum, westore the last visit time, as well as the time we last saw you. |
Paranoid (IV) Inmate From: Kansas City, MO , USA |
posted 11-05-2006 22:36
that would be great, thanks! |
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 11-06-2006 10:24
ok, here you go: code: // set cookies for the highlighting of unread forums & threads $iMinimumTimeBetweenVisits = 900; if (g_retrieveUserSetting('lastVisit') !== NULL && (time() - $iMinimumTimeBetweenVisits > g_retrieveUserSetting('lastVisit'))) { g_storeUserSetting('lastVisit',g_retrieveUserSetting('thisVisit')); } elseif (g_retrieveUserSetting('lastVisit') === NULL) { g_storeUserSetting('lastVisit',time()); } g_storeUserSetting('thisVisit',time());
code: function g_storeUserSetting($strKey,$value) { $arrData = false; if (isset($_COOKIE[$GLOBALS['g_str']['%%cookiename']. 'settings'])) { $arrData = @unserialize(urldecode($_COOKIE[$GLOBALS['g_str']['%%cookiename']. 'settings'])); } if (!is_array($arrData)) $arrData = array(); $arrData[$strKey] = $value; $strData = urlencode(serialize($arrData)); setcookie($GLOBALS['g_str']['%%cookiename']. 'settings',$strData,time() + 3600 * 24 * 30,'/',CONFIG_DOMAIN,0); $_COOKIE[$GLOBALS['g_str']['%%cookiename']. 'settings'] = $strData; } function g_retrieveUserSetting($strKey) { if (isset($_COOKIE[$GLOBALS['g_str']['%%cookiename']. 'settings'])) { $arrData = @unserialize(urldecode($_COOKIE[$GLOBALS['g_str']['%%cookiename']. 'settings'])); if (isset($arrData[$strKey])) return $arrData[$strKey]; else return NULL; } return NULL; }
code: function g_isNewSinceLastVisit($pageDate) { $strFormat = "Y-m-d H:i:s"; if (is_numeric($pageDate)) $pageDate = date($strFormat,$pageDate); return ((g_retrieveUserSetting('lastVisit') != '') && $pageDate > date($strFormat, g_retrieveUserSetting('lastVisit'))); }
|