<?php
defined('ROOT') or define('ROOT', str_replace('\\', '/', realpath(dirname (__FILE__))));
require_once ROOT . '/system/init.php'; // инициализация ядра

$id = abs(intval($_GET['ididid']));

$referer = $_GET['ref'];
function go($href) {
return '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Переход</title>
<meta http-equiv="refresh" content="0; url='.$href.'"/>
</head><body><a href="'.$href.'"><b>Переход</b></a></body></html>';
}
ignore_user_abort();
if ($_GET['id'] == '1') {
$rand = rand(1, 15);
$type = 'ClickUnder';

if ($rand == 1) $type = 'teasers';
if ($rand == 2) $type = 'ads';
if ($rand == 4) $type = 'banners';
//DB :: run() -> query ("UPDATE `counter` SET `pokaz` = `pokaz`+2 WHERE `type` = '".$type."';");
$href = '/click.php?md5='.md5($_GET['id'].date("dmyh", time()).'Ulty').'&ref=http://clik.online/&id=1&type='.$type;
echo go($href);
exit;
}
if ($_GET['md5'] !== md5($id.date("dmyh", time()).'Ulty')) {
echo go($set['link_bws']);
echo "<font color=\"red\">MD5 da xatolik. md5 to'g'ri kelmayapti</font>";
exit;
}

$usr = DB :: run() -> queryFetch("SELECT `user_id` FROM `sites` WHERE `id` = '".$id."';");
$id = $usr['user_id'];

$href = '/click.php?md5='.md5($id.date("dmyh", time()).'Ulty').'&ref='.$_SERVER['HTTP_REFERER'].'&id='.$id.'&type='.$_GET['type'];
echo go($href);
?>
