<?php
defined('ROOT') or define('ROOT', str_replace('\\', '/', realpath(dirname (__FILE__))));
require_once ROOT . '/system/init.php'; // РёРЅРёС†РёР°Р»РёР·Р°С†РёСЏ СЏРґСЂР°
$id = abs(intval($_GET['id']));
$click2 = DB :: run() -> querySingle("SELECT COUNT(*) FROM `sites` WHERE `id`= ? AND `active` = ? LIMIT 1;", array($id, 1));
   if($click2 == 0) {
   echo 'Moderation';
   exit;
   }
?>
var site_id = <?php echo $id; ?>;
var params = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"
function PopShow3() {
CookieTest=navigator.cookieEnabled;
if(CookieTest)
{
ClickUndercookie = GetCookie('clickunder');
if (ClickUndercookie == null)
{
var ExpDate = new Date ();
ExpDate.setTime(ExpDate.getTime() + (4 * 60 * 60 * 1000));
SetCookie('clickunder','1',ExpDate, "/");
window.open("<?php echo HOST; ?>/go.php?md5=<?php echo md5($id.date('dmyh', time())."Ulty"); ?>&ididid="+site_id+"&type=ClickUnder", "Clik.online", params);
window.focus();
}
}
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
document.onmouseup=PopShow3;
if((self.parent&&!(self.parent===self))&&(self.parent.frames.length!=0)){
	top.location.href='http://bymas.ru';
}
<?php
$usr = DB :: run() -> queryFetch("SELECT `user_id` FROM `sites` WHERE `id` = '".$id."';");
$id = $usr['user_id'];
  $click = DB :: run() -> querySingle("SELECT COUNT(*) FROM `click_db` WHERE `user_id`= ? AND `ip` = ? AND `browser` = ? AND `date` = ? AND `type` = ? LIMIT 1;", array($id, $ip, $useragent, date('d.m.Y'), 'ads'));
  $clickip = DB :: run() -> querySingle("SELECT COUNT(*) FROM `click_db` WHERE `user_id`= ? AND `ip` = ? AND `date` = ? AND `type` = ? LIMIT 1;", array($id, $ip, date('d.m.Y'), 'ads'));

  if($click == 0 && $clickip == 0) {
DB :: run() -> query ("UPDATE `counter` SET `pokaz` = `pokaz`+1 WHERE `type` = 'ClickUnder';");
}
?>