"; $page_name = $_SERVER['HTTP_REFERER']; $nApartPos = stripos($page_name, "Apart"); echo ""; */ function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = microtime_float(); $listingName = ""; $tempListingID = 0; //clearstatcache(); if(isset($_GET['listingName'])) { $listingName = $_GET['listingName']; } // echo "$listingName"; include("include/common.php"); if (strlen($listingName)) { $tempListingID = getListingID($listingName); //echo "$tempListingID"; if (intval($tempListingID) == 0) { header("HTTP/1.0 404 Not Found"); //exit(); } //echo " the temp id = $tempListingID
"; } // echo " the listing id = $listingID"; // Test $listingName /* { header("HTTP/1.0 404 Not Found"); } */ $strContent =""; $file = "listingview_byname.htm"; $file .= "_"; $file .= $listingName; //$bNeedToCacheIt = TRUE; // check for the cache first. $nCache = file_exists("c9234570/$file"); //echo "file = $nCache"; //exit; if ($nCache !== FALSE) { // make sure its not the "not found page" if (filesize("/home/bostonc/public_html/c9234570/$file") > 2000) { // scale to minutes. $Diff = (time() - filectime("c9234570/$file"))/60; //echo "the diff = $Diff"; //exit; // If it changed in the last 3 hours use the cache. if ($Diff < 300) //if ($Diff < 0) { //echo "the diff = $Diff"; //exit; $strContents = file_get_contents("c9234570/$file"); echo "$strContents"; // $bNeedToCacheIt = FALSE; $time_end = microtime_float(); $timediff = $time_end - $time_start; //echo ""; exit(); } } } $strURL = 'http://www.boston-condo.com'; //$strURL = "http://host.averyst.com/~bostonc"; $strURL .= "/listingview_new_name_real.htm?listingName="; $strURL .= $listingName; // echo $strURL; $strContent = file_get_contents ($strURL); // if it is a 404 if (strpos($strContent, "rg/TR/html4/str") !== FALSE) { header("HTTP/1.0 404 Not Found"); } else { // Write the cache. if (!$handle = fopen("c9234570/$file", 'w')) { echo "Cannot open file ($file)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $strContent) === FALSE) { echo "Cannot write to file ($file)"; exit; } } echo "$strContent"; $time_end = microtime_float(); $timediff = $time_end - $time_start; echo ""; ?>