<?php


########################
#Имя Скрипта: Keo v1#
#Автор: GulievMMA#
#E-mail: guliev.mma@gmail.com#
#Telegram: @GulievMMA98#
#WhatsApp: +994777683939#
#WhatsApp: +994559687869#
########################
#Страна: Азербайджан#
#Город: Сумгайыт#
########################
#Сайт: KeoTop.Ru#
#Сайт: TopWap.Ru#
#Сайт: SeksTop.Ru#
#Сайт: MobTop.Su#
#Сайт MobStats.Ru#
#Сайт: xTopi.Ru#
#Сайт: ByPHP.Ru#
#Сайт: WapFiles.Ru#
#Сайт: XNXX69.Ru#
########################
#Автор Счетчиков: Pavel963#
#Telegram: @Pasha963#
#Цена: 420₽#
########################
#Скрипт Принадлежит Мне , Продавать и Распростронять Нельзя (!)#
########################


header("Expires: on, 01 Jan 1970 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
define('NTOP', 1);
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
error_reporting(0);
header("Content-type: image/png");
header("Expires: on, 01 Jan 1970 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
//if (!$ip) $ip = $_SERVER['REMOTE_ADDR'];

$sait_t = mysqli_query($mysqli,"SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `id` = '".$id."'");
$sit = mysqli_fetch_array(mysqli_query($mysqli,"SELECT * FROM `".$prefix."sait` WHERE `id` = '".$id."'"));
if(mysqli_num_rows($sait_t) > 0)
{
if($sit['ban'] == 1){
header("Content-type: image/png");
$imgban = 'images/ban.png';
$image3 = imagecreatefrompng($imgban);
imagepng($image3);
imageDestroy($image3);
exit;
}
$sait = mysqli_fetch_array($sait_t);
$img = 'images/big/'.$sait['imagebig'].'.png';
$image = imagecreatefrompng($img);
$type_img = mysqli_fetch_array(mysqli_query($mysqli,"SELECT * FROM `".$prefix."images` WHERE `name` = '".$sait['imagebig']."'"));
$old_day = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$operator_id = mysql_query($mysqli,"SELECT `id_c` FROM `".$prefix."ip` WHERE INET_ATON('".$ip."') BETWEEN `start` AND `finish`");
		if(mysqli_num_rows($operator_id) > 0)
			{
				$arr = mysql_fetch_array($operator_id);
				$operator = $arr['id_c'];
			}
		else
			{
				$operator = 1000;
			}
		$isset = mysqli_query($mysqli,"SELECT * FROM `".$prefix."hosts` WHERE `id_sait` = '".$id."' AND `ip` = '".$ip."' AND `time` > '".$old_day."'");
		if (mysqli_num_rows($isset) == 0)
			{
				mysqli_query($mysqli,"INSERT INTO `".$prefix."hosts` SET
                `time` = '".time()."',
                `id_sait` = '".$id."',
                `ip` = '".$ip."',
                `browser` = '".browser()."',
                `operator` = '".$operator."'");
				mysqli_query($mysqli,"UPDATE `".$prefix."sait` SET `hosts` = (`hosts` + 1), `all_hosts` = (`all_hosts` + 2) WHERE `id` = '".$id."'");


         mysqli_query($mysqli,"INSERT INTO `".$prefix."hits` SET
                `time` = '".time()."',
                `id_sait` = '".$id."',
                `ip` = '".$ip."',
                `browser` = '".browser()."',
                `operator` = '".$operator."'");
         mysqli_query($mysqli,"UPDATE `".$prefix."sait` SET `hits` = (`hits` + 1), `all_hits` = (`all_hits` + 2) WHERE `id` = '".$id."'");


			}
		else 
			{
				mysqli_query($mysqli,"INSERT INTO `".$prefix."hits` SET
                `time` = '".time()."',
                `id_sait` = '".$id."',
                `ip` = '".$ip."',
                `browser` = '".browser()."',
                `operator` = '".$operator."'");
				mysqli_query($mysqli,"UPDATE `".$prefix."sait` SET `hits` = (`hits` + 1), `all_hits` = (`all_hits` + 2) WHERE `id` = '".$id."'");
			}
		if (mysqli_num_rows(mysqli_query($mysqli,"SELECT * FROM `".$prefix."sait_online` WHERE `ip` = '".$ip."' AND `ua` = '".$ua."' AND `time` > '".(time()-180)."' AND `id_sait` = '".$id."'")) == 1)
			{
				mysqli_query($mysqli,"UPDATE `".$prefix."sait_online` SET `time` = '".time()."' WHERE `ip` = '".$ip."' AND `ua` = '".$ua."' AND `id_sait` = '".$id."' LIMIT 1");
			}
		else
			{
				mysqli_query($mysqli,"DELETE FROM `".$prefix."sait_online` WHERE `time` < '".(time()-180)."' AND `id_sait` = '".$id."'");
				mysqli_query($mysqli,"INSERT INTO `".$prefix."sait_online` (`id_sait`,`ip`, `ua`, `time`) values('".$id."','".$ip."', '".$ua."', ".time().")");
			}


$real_stat = mysqli_fetch_array(mysqli_query($mysqli,"SELECT * FROM `".$prefix."sait` WHERE `id` = '".$id."'"));
$hits = 69 - (strlen($real_stat['hits']) * 5);
$hosts = 35 - (strlen($real_stat['hosts']) * 5);
$black = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
ImageString($image,1,$hosts,15,$real_stat['hosts'],$black);
ImageString($image,1,$hits,15,$real_stat['hits'],$black);
//
/*$url_ud = 'http://' . $row['url'];
$tekshir = getCI($url_ud);
if($tekshir == 1){
$tis_tis = '';
}else{
$tis_tis = 'тИЦ' . getCI($url_ud) . '';
}
$tis = 67 - (strlen($tis_tis) * 1);
$white1 = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
ImageString($image,1,$tis,4,$tis_tis,$white1);*/

}
else
{
$img = 'images/default.png';
$image = imagecreatefrompng($img);
}
imagepng($image);
imageDestroy($image);

?>