Surfbar continued (unfinished) and some updates:
[mailer.git] / inc / mysql-manager.php
index 2774a3ba1c62fe7c7045701ff80e89703471acd7..5433a771ee5f5ac4f3929ba7b891a657c4a07eea 100644 (file)
@@ -583,10 +583,16 @@ function WHAT_IS_VALID($act, $wht, $type="guest")
 //
 function IS_MEMBER()
 {
-       global $status, $LAST;
+       global $status, $LAST, $cacheArray;
        if (!is_array($LAST)) $LAST = array();
        $ret = false;
 
+       // is the cache entry there?
+       if (isset($cacheArray['is_member'])) {
+               // Then return it
+               return $cacheArray['is_member'];
+       } // END - if
+
        // Fix "deleted" cookies first
        FIX_DELETED_COOKIES(array('userid', 'u_hash', 'lifetime'));
 
@@ -639,29 +645,26 @@ function IS_MEMBER()
                unset($GLOBALS['userid']);
        }
 
+       // Cache status
+       $cacheArray['is_member'] = $ret;
+
        // Return status
        return $ret;
 }
 //
-function UPDATE_LOGIN_DATA ($UPDATE=true) {
+function UPDATE_LOGIN_DATA () {
        global $LAST, $_CONFIG;
        if (!is_array($LAST)) $LAST = array();
 
-       // Are the required cookies set?
-       if ((!isset($GLOBALS['userid'])) || (!isSessionVariableSet('u_hash')) || (!isSessionVariableSet('lifetime'))) {
-               // Nope, then return here to caller function
-               return false;
-       } else {
-               // Secure user ID
-               $GLOBALS['userid'] = bigintval(get_session('userid'));
-       }
+       // Recheck if logged in
+       if (!IS_MEMBER()) return false;
+
+       // Secure user ID
+       $GLOBALS['userid'] = bigintval(get_session('userid'));
 
        // Extract last online time (life) and how long is auto-login valid (time)
        $newl = time() + bigintval(get_session('lifetime'));
 
-       // Recheck if logged in
-       if (!IS_MEMBER()) return false;
-
        // Load last module and last online time
        $result = SQL_QUERY_ESC("SELECT last_module, last_online FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {