".time()."-300 "))<3) { $bonusvaxt = time()-54000; if (mysql_num_rows(mysql_query("SELECT `id` FROM `stats_".$s_a[$nm]."` WHERE `site_id`='".$id."' AND `browser`='".$_SERVER['HTTP_USER_AGENT']."' AND `ip`='".$ip."' AND `time`>'".$bonusvaxt."';"))==0) { $referer = explode("?",$_SERVER['HTTP_REFERER']); $add_stats = mysql_query("INSERT INTO `stats_".$s_a[$nm]."` (`site_id`, `browser`, `ip`, `country_code`, `country_name`, `op`, `referer`, `time`) VALUES ( '".$id."', '".mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])."', '".$ip."', '".$cc."', '".$cn."', '".$op."', '".mysql_real_escape_string($referer[0])."', '".time()."' )"); $update_site = mysql_query("UPDATE `sites` SET `host`=`host`+1 , `hit`=`hit`+1 WHERE `id`='".$id."' LIMIT 1 "); $_SESSION['view'.$id] = 1; } else { $update_stats = mysql_query("UPDATE `stats_".$s_a[$nm]."` SET `time`='".time()."' WHERE `site_id`='".$id."' AND `browser`='".$_SERVER['HTTP_USER_AGENT']."' AND `ip`='".$ip."' LIMIT 1 "); $update_site = mysql_query("UPDATE `sites` SET `hit`=`hit`+1 WHERE `id`='".$id."' LIMIT 1 "); } } } else { $update_stats = mysql_query("UPDATE `stats_".$s_a[$nm]."` SET `time`='".time()."' WHERE `site_id`='".$id."' AND `browser`='".$_SERVER['HTTP_USER_AGENT']."' AND `ip`='".$ip."' LIMIT 1 "); $update_site = mysql_query("UPDATE `sites` SET `hit`=`hit`+1 WHERE `id`='".$id."' LIMIT 1 "); } /* define('MEMCACHE_HOSTNAME', 'localhost'); define('MEMCACHE_PORT', 11211); define('MEMCACHE_NAMESPACE', $_SERVER["HTTP_HOST"]); include dirname(__FILE__).'/inc/classes/memcache.php'; $memcache = new Cache; $memcache->connect();*/ if($confunserialize[0]==1){ $banner = "img/none.png"; $img = imageCreateFromPNG($banner); header( "Content-type: image/png" ); imagepng( $img ); }else{ if ($mod == "home") { $host = $s_a[0]; $hit = $s_a[1]; if (strlen($host)==1) $host_w = 65; else if (strlen($host)==2) $host_w = 60; else if (strlen($host)==3) $host_w = 55; else if (strlen($host)==4) $host_w = 50; else if (strlen($host)==5) $host_w = 45; else if (strlen($host)==6) $host_w = 40; else if (strlen($host)==7) $host_w = 35; else $host_w = 35; if (strlen($hit)==1) $hit_w = 65; else if (strlen($hit)==2) $hit_w = 60; else if (strlen($hit)==3) $hit_w = 55; else if (strlen($hit)==4) $hit_w = 50; else if (strlen($hit)==5) $hit_w = 45; else if (strlen($hit)==6) $hit_w = 40; else if (strlen($hit)==7) $hit_w = 35; else $hit_w = 35; $banner = "img/home.png"; /*$cacheKey = md5('count.php'.$banner.$id); $html = $memcache->get($cacheKey); if ( ! $html ) {*/ ob_start(); $img = imageCreateFromPNG($banner); $font = $_SERVER['DOCUMENT_ROOT']."/arial.ttf"; $host_color = imagecolorallocate( $img, 255, 0, 0 ); imagettftext($img, 7, 0, $host_w, 10, $host_color, $font, $host); imagettftext($img, 7, 0, $hit_w, 22, $host_color, $font, $hit); header( "Content-type: image/png" ); imagepng( $img ); // Cache time in seconds (10 seconds) /*$cacheTime = 10; $memcache->set($cacheKey, ob_get_contents(), $cacheTime);*/ // ob_end_clean(); imagedestroy( $img ); exit; /*} else { header( "Content-type: image/png" ); echo $html; exit; }*/ } else { $banner = "img/small.png"; // $cacheKey = md5('count.php'.$banner.$id); // // $html = $memcache->get($cacheKey); if ( ! $html ) { ob_start(); $img = imageCreateFromPNG($banner); header( "Content-type: image/png" ); imagepng( $img ); // Cache time in seconds (7 day) $cacheTime = 60 * 60 * 24 * 7; $memcache->set($cacheKey, ob_get_contents(), $cacheTime); // ob_end_clean(); imagedestroy( $img ); exit; } else { header( "Content-type: image/png" ); echo $html; exit; } } } ?>