File size: 2.32Kb
<?
require('./_inc/configuration.php');
require('./_inc/functions.php');
$do = isset($_GET['do']) ? $_GET['do'] : '';
$id = isset($_GET['id']) && ctype_digit($_GET['id']) ? $_GET['id'] : 0;
$ip = $_SERVER['REMOTE_ADDR'];
$ua = $_SERVER['HTTP_USER_AGENT'];
if(strpos($ua, 'Google') !== false || strpos($ua, 'Yandex') !== false || strpos($ua, 'Rambler') !== false)
{
header('location: '.$go_to);
}
if(mysql_num_rows(mysql_query('SELECT `id` FROM `sites` WHERE `id` = '.$id.' AND `blocking` = 1;')) == 0)
{
header('location: '.$go_to);
}
if(mysql_num_rows(mysql_query('SELECT `id` FROM `ips` WHERE INET_ATON("'.$ip.'") BETWEEN `start_ip` AND `end_ip`;')) == 0)
{
header('location: '.$go_to);
}
if(mysql_num_rows(mysql_query('SELECT `id` FROM `logs` WHERE `ip` = "'.$ip.'" and `ua` = "'.mysql_escape_string($ua).'" and `user` = '.$id.';')) > 15)
{
header('location: '.$go_to);
}
if($do == 'go')
{
if($_SESSION['go'] != TRUE) header('location: '.$go_to);
$operator = mysql_result(mysql_query('SELECT `id` FROM `ips` WHERE INET_ATON("'.$ip.'") BETWEEN `start_ip` AND `end_ip`;'),0);
$price = (mysql_result(mysql_query('SELECT `price` FROM `ips` WHERE INET_ATON("'.$ip.'") BETWEEN `start_ip` AND `end_ip`;'),0)/1000);
mysql_query('INSERT INTO `logs` SET `user` = '.$id.', `date` = UNIX_TIMESTAMP(), `operator` = '.$operator.', `added` = "'.$price.'", `ip` = "'.$ip.'", `ua` = "'.mysql_escape_string($ua).'";') or error('Unknown error!');
mysql_query('UPDATE `sites` SET `balance` = `balance` + "'.$price.'" WHERE `id` = '.$id.';') or error('Unknown error!');
unset($_SESSION['go']);
header('location: '.$go_to);
die();
}
$_SESSION['go'] = (boolean)TRUE;
header("Content-type: text/vnd.wap.wml; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo '<?xml version="1.0" encoding="utf-8"?>'.
'<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"'.
' "http://www.wapforum.org/DTD/wml_1.1.xml">'.
'<wml>'.
'<head>'.
'<meta http-equiv="Cache-Control" content="no=cache" forua="true" />'.
'</head>'.
'<card id="go" title="Please Wait.." ontimer="go.php?id='.$id.'&do=go&'.SID.'"><timer value="20" />'.
'<p align="center">'.
'Пожалуйста подождите ;-)<br/>'.
'</p></card></wml>';
?>