Harz-Paradies.de
Harz Städte

Harz Winter

Harz Aktiv

Harz Wellness

Kunst und Kultur im Harz

Tier und Natur im Harz



Home
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
     
  Banner und Linktexte von www.Harz-Paradies.de
     
  Ihnen gefällt unsere Seite? Binden Sie unsere Seite auf Ihrer Homepage mit ein. Hier finden Sie verschiedene
  Banner und Linktexte zum einbinden.
       
   
     
       
       
       
       
       
       
     
       
       
       
       
       
       
       
       
       
       
       
       
 
   
 
Harz-Paradies.de
 
config = unserialize(BACKLINK_SELLER); $cachingDirectory = substr($this->config['CACHED_FILE_PATH'], 0, strrpos($this->config['CACHED_FILE_PATH'], '/') + 1); if($this->config['CACHING_ENABLED_FLAG'] && is_writable($cachingDirectory)) {return $this->retrieveHTMLWithCaching();} return $this->retrieveHTMLFromServer(); } function retrieveHTMLWithCaching() { if($this->isCachedFileExpired()) { $response = $this->retrieveHTMLFromServer(); //if server is down then cache HTML response for max 48 hours if($response == 'UNABLE_TO_CONNECT' && $this->isCachedFileExpired(48)) { //backlinkseller server is still not available //in this case we empty cached file $this->writeHTMLToCachedFile(''); } else { //update cached file $this->writeHTMLToCachedFile($response); } } return $this->loadHTMLFromCachedFile(); } function retrieveHTMLFromServer() { //build request $request = '/channel.php?domain_id=' . $this->config['DOMAIN_ID'] . '&account_id=' . $this->config['ACCOUNT_ID'] . '&html_before=' . urlencode($this->config['HTML_BEFORE_BACKLINK']) . '&html_after=' . urlencode($this->config['HTML_AFTER_BACKLINK']) . '&page=' . urlencode($this->config['PAGE_URL']) . '&xhtml=1' . '&user_ip=' . $this->config['USER_IP']; if($this->config['TEST_FLAG']) {$request .= '&test=1';} if(isset($this->config['HYPERLINK_CLASS'])) {$request .= '&class=' . urlencode($this->config['HYPERLINK_CLASS']);} //try to connect to backlinkseller server @$socket = fsockopen('channel9.backlinkseller.de', 80, $errorNumber, $errorMessage, 5); if(!$socket) {return 'UNABLE_TO_CONNECT';} //retrieve response $response = null; stream_set_timeout($socket, 5); fwrite($socket, 'GET ' . $request . " HTTP/1.1\r\nHost: channel9.backlinkseller.de\r\n\r\n"); $response = fread($socket, 1000000); fclose($socket); if(strpos($response, "\r\n\r\n") !== false) {$response = trim(substr($response, strpos($response, "\r\n\r\n")));} if(!$this->config['DEBUG_FLAG']) //if debug is disabled { //if response contains any message and not HTML code as expected if(substr($response, 0, 7) == 'ERROR: ' || substr($response, 0, 4) == 'OK: ') {return '';} //do not display this message } $response = str_replace(array('\"', "\\'"), array('"', "'"), $response); //remove quotes return $response; } function writeHTMLToCachedFile($html) { $handle = fopen($this->config['CACHED_FILE_PATH'], 'w'); flock($handle, LOCK_EX); fwrite($handle, $html); flock($handle, LOCK_UN); fclose($handle); } function loadHTMLFromCachedFile() { if(file_exists($this->config['CACHED_FILE_PATH'])) {return file_get_contents($this->config['CACHED_FILE_PATH']);} return ''; } function isCachedFileExpired($hoursToLive = 1) { if(!file_exists($this->config['CACHED_FILE_PATH'])) {return true;} if(filemtime($this->config['CACHED_FILE_PATH']) < time() - (60 * 60 * $hoursToLive)){return true;} return false; } } } //output backlinkseller html with backlinks $backlinkseller = new BacklinkSeller(); echo($backlinkseller->retrieveHTML()); ?>