Файл: shoop/click/go.php
Строк: 45
<?php
include "config.php";
include "oper.php";
$time=time();
$ips =@$_SERVER['REMOTE_ADDR'];
$agent = $_SERVER['HTTP_USER_AGENT'];
$agent=htmlspecialchars(mysql_escape_string($agent));
$mobile=strip_tags($agent);
//$mobile=strtok($agent,"/");
$id=$_GET['id'];
if (!isset($id) || !is_numeric($id))
{
header("Location: $site2");
}
if(isset($id)&&is_numeric($id)){
$res=mysql_query("select * from `links` where id='$id';");
$kolss=mysql_num_rows($res);
If (!mysql_num_rows($res)){
mysql_close();
header("Location: $site2");
}
If (mysql_num_rows($res)){
$ccc=mysql_result($res,0,"$country");
$site=mysql_result($res,0,"site");
$nsite=mysql_result($res,0,"nsite");
$bal=mysql_result($res,0,"balans");
$res=mysql_query("select `id` from `mstat` where id='$id' && dat='$date_serv' ");
If (!mysql_num_rows($res)){ mysql_query("insert into `mstat` (`id`,`dat`,`host1`,`hit1`,`host2`,`hit2`) values ('".$id."','".$date_serv."','0','0','0','0') "); }
@include "test.php";
if ($bal!="*" && $bal<1) {
mysql_close();
header("Location: $site2");
}
else {
if ($ccc>0) {
$q=mysql_query("select * from `click` where id='$id' && type='0' && agent='$mobile' && ip='$ips' ;");
if (!mysql_num_rows($q)) {
mysql_query("Update `mstat` set `host2`=`host2`+1, `hit2`=`hit2`+1 where `id`='$id' && `dat`='$date_serv' ");
@mysql_query("insert into `click` values('$id','0','$mobile','$ips')");
}
if (mysql_num_rows($q)) {
mysql_query("Update `mstat` set `hit2`=`hit2`+1 where `id`='$id' && `dat`='$date_serv' ");
}
mysql_close();
header("Location: $nsite");
}
else
{
$qs=mysql_query("select * from `click` where id='$id' && type='1' && agent='$mobile' && ip='$ips' ;");
if (!mysql_num_rows($qs)) {
mysql_query("Update `mstat` set `host1`=`host1`+1, `hit1`=`hit1`+1 where `id`='$id' && `dat`='$date_serv' ");
@mysql_query("insert into `click` values('$id','1','$mobile','$ips')");
if ($bal!="*") {
mysql_query("Update `links` set `balans`=`balans`-1 where id=$id "); }
@mysql_query("Update `oper_hit` set `$oper`=`$oper`+'1' where idaa='$id' ");
@mysql_query("Update `oper_host` set `$oper`=`$oper`+'1' where idaa='$id' ");
header("Location: $site");
}
if (mysql_num_rows($qs)) {
@mysql_query("Update `oper_hit` set `$oper`=`$oper`+'1' where idaa='$id' ");
mysql_query("Update `mstat` set `hit1`=`hit1`+1 where `id`='$id' && `dat`='$date_serv' ");
if ($tclick==0) {
header("Location: $site");
} else { header("Location: $site2"); }
}
mysql_close();
} //ccc
} // bal
} //res
} //isset
?>