// Ask the database
$result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt
FROM "._MYSQL_PREFIX."_surfbar_locks
-WHERE userid=%s AND url_id=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_DATA('surf_lock').") >= UNIX_TIMESTAMP(last_surfed)
+WHERE userid=%s AND url_id=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_DATA('surf_lock').") < UNIX_TIMESTAMP(last_surfed)
+ORDER BY last_surfed ASC
LIMIT 1",
array($GLOBALS['userid'], bigintval($id)), __FILE__, __LINE__
);
// Return check
//* DEBUG: */ echo __FUNCTION__.":cnt={$cnt}<br />\n";
- return ($cnt == 0);
+ return ($cnt == 1);
}
// Determine next id for surfbar view, always call this before you call other
// getters below this function!!!