// this hack is at Sylvia's request if ($_SERVER['REQUEST_URI'] == '/linktrack.php?bid=154211') { // redirect header('HTTP/1.1 301 Moved Permanently'); header("Location: http://www.phoenixkids.com/"); exit; } $usfgincludes = "/var/www/html/usfamilyguide.com/user/includes"; require_once("$usfgincludes/config.php"); /* if (!isset($_GET['bid'])) { // MUST have a businessID echo "I'm sorry. This page has been incorrectly accessed."; exit; } */ $type = $_GET['type']; $regionid = $_GET['regionid']; $bid = $_GET['bid']; $id = $_GET['id']; $listingid = $_GET['listingid']; if (!$type) $type = 'none'; if (!$id) $id = 'none'; elseif (! is_numeric($id)) exit; // id must be a number (or 'none' as assigned above). If not, we have a hack attempt. // get link switch ($type) { case 'none': $query = "SELECT link FROM clients WHERE businessID='$bid' AND active='1'"; break; case 'listing': $query = "SELECT listingURL FROM clients, listings WHERE clients.businessid = listings.businessid AND listingid='$listingid' AND active='1'"; break; case 'externalmap': $query = "SELECT externalmap FROM listings WHERE listingid='$listingid'"; break; case 'calendar': $query = "SELECT link FROM events_calendar WHERE eventid='$id'"; break; case 'herographic': $query = "SELECT link FROM clients WHERE businessid='$bid' AND active='1'"; $listingid = $id; // this is the 'picid' of the hero graphic break; case 'herographiccustomlink': $query = "SELECT link FROM herographics WHERE picid='$id' AND active='1'"; $listingid = $id; // this is the 'picid' of the hero graphic break; /* default: echo "I'm sorry. This page has been incorrectly accessed."; exit; */ } $result = @mysql_query($query); list($link) = @mysql_fetch_row($result); if (!$link) { // don't try to redirect unless we have a $link //echo "I'm sorry. This page has been incorrectly accessed."; header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found", true, 404); echo "
The requested URL was not found on this server.
\n"; exit; } // check for bots $human = TRUE; include('/var/www/html/botlist.php'); $useragent = $_SERVER['HTTP_USER_AGENT']; foreach ($bots as $bot) { if (stristr($useragent, $bot) !== FALSE) $human = FALSE; } if (!$useragent) $human = FALSE; // empty string if ($human) { // TEMPORARY TRACKING SECTION /* $useragent = addslashes($useragent); $query = "INSERT INTO useragenttrack SET requesttime=NOW(), ipaddress='" . $_SERVER['REMOTE_ADDR'] . "', useragent='$useragent', request='" . $_SERVER['REQUEST_URI'] . "'"; $result = mysql_query($query); */ // END TEMPORARY TRACKING SECTION // how many links already today? $query = "SELECT num FROM linktrack WHERE bid='$bid' AND type='$type' AND id='$listingid' AND regionid='$regionid' AND linkdate=CURDATE()"; $result = mysql_query($query); list($num) = mysql_fetch_row($result); $num++; // record the link if (mysql_num_rows($result) > 0) $query = "UPDATE linktrack SET num='$num' WHERE bid='$bid' AND type='$type' AND id='$listingid' AND regionid='$regionid' AND linkdate=CURDATE()"; else $query = "INSERT INTO linktrack SET bid='$bid', type='$type', id='$listingid', regionid='$regionid', linkdate=CURDATE(), num=1"; $result = mysql_query($query); } // redirect header('HTTP/1.1 301 Moved Permanently'); header("Location: $link"); exit; ?>