File size: 1.96Kb
<?php
include'../ini.php';
$s = mysql_fetch_array(mysql_query("select * from `kat_data` where `n`='site'"));
if(intval($_COOKIE['go'])!=date("dmy")){
if(isset($_SERVER['HTTP_X_FORWADED_FOR'])) $ip = $_SERVER['HTTP_X_FORWADED_FOR']; else $ip = @$_SERVER['REMOTE_ADDR'];
$ids = abs(intval($_GET['id'])); $time = time(); $date = date("d.m.y");
$ips = split("\.", "$ip"); $ipn = $ips[3] + $ips[2] * 256 + $ips[1] * 256 * 256 + $ips[0] * 256 * 256 * 256;
$ua = mysql_real_escape_string(htmlspecialchars(trim(stripslashes($HTTP_USER_AGENT)),ENT_QUOTES));
$ref = mysql_real_escape_string(htmlspecialchars(trim(stripslashes($_SERVER['HTTP_REFERER']))));
$op = mysql_fetch_array(mysql_query("select * from `kat_op` where `ipn1`>='$ipn' and `ipn2`<='$ipn' limit 1"));
if($op[name])$oper = "$op[name]"; else $oper='No IP';
if(abs(intval($_GET['k']))==0){
$kod = mt_rand(11111,99999);
mysql_query("insert into `kat_go` set `ids` = '$ids', `ip`='$ip', `time`='$time', `date`='$date', `kod`='$kod', `oper`='".$op['name']."', `country`='".$op[country]."', `refer`='$ref', `ua`='$ua', `stat`='0'") or die (mysql_error());
include'page.php';
exit;
}else{$kod = abs(intval($_GET['k']));
SetCookie("go",date("dmy"),time()+9999999);
if(mysql_num_rows(mysql_query("select * from `kat_go` where `ids`='$ids' and `kod`!='0'"))!=0){
if($oper!='No IP'){
if(mysql_num_rows(mysql_query("select * from `kat_go` where `ids`='$ids' and `ip`='$ip' and `date`='$date' and `kod`!='$kod'"))==0){
mysql_query("update `kat_go` set `kod`='0', `stat`='1' where `ids`='$ids' and `kod`='$kod' and `date`='$date'");
mysql_query("update `kat_sites` set `in`=`in`+'1' where `id`='$ids'");
}else{mysql_query("update `kat_go` set `kod`='0' where `ids`='$ids' and `kod`='$kod' and `date`='$date'");}
} }
} }
header("location: http://$s[p]");
?>