// 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!!!
require_once(PATH."inc/header.php");
// Load template
- if ((isset($_GET['frame'])) && ($_GET['frame'] == "start")) {
+ if (((isset($_GET['frame'])) && ($_GET['frame'] == "stop")) || (!isset($_GET['frame']))) {
// Load template for "start" page
LOAD_TEMPLATE("surfbar_frame_start");
// Load banner
OUTPUT_HTML("<br />");
LOAD_TEMPLATE("surfbar_start_banner");
+
+ // This makes the footer appear again
+ unset($_GET['frame']);
} else {
// Prepare content
$content = array(
SURFBAR_GET_NEXT_ID($_GET['id']);
// Check reload lock and validation code
- if ((SURFBAR_CHECK_RELOAD_LOCK($_GET['id'])) && (SURFBAR_CHECK_VALIDATION_CODE($_GET['id'], $_GET['check'], $_GET['salt']))) {
+ if ((!SURFBAR_CHECK_RELOAD_LOCK($_GET['id'])) && (SURFBAR_CHECK_VALIDATION_CODE($_GET['id'], $_GET['check'], $_GET['salt']))) {
// Lock the URL (id) down
SURFBAR_LOCKDOWN_ID($_GET['id']);