File size: 2.51Kb
<?php
# Сщетчик переходов с статистикой по операторам ver 1.0
# Автор скрипта Корнилов Александр aka GrOb
# e-mail: [email protected]; [email protected]
# ICQ: 191-171
# WAP: http://o5wap.ru
include('config.php');
include('oper.php');
if($oper<1 || $oper>26 || $oper=='') $oper=0;
if(!isset($_GET['go'])){
header("Location: ".$site."");
exit;}
$go=preg_replace("/[^0-9]/","",$_GET['go']);
$d=date('d');
$m=date('m');
$y=date('Y');
$ip_bro=@$_SERVER['HTTP_USER_AGENT'].'-'.$ip;
$sqlx = @mysql_query("SELECT `url` FROM `click_user` WHERE `id`='".$go."' LIMIT 1;");
$test_go=@mysql_num_rows($sqlx);
if(!$sqlx || $test_go<1){
header("Location: ".$site."");
exit;}
$fieldx=@mysql_fetch_array($sqlx);
$url=$fieldx['url'];
$sql = @mysql_query("SELECT * FROM `click_opsos` WHERE `uid`='".$go."' AND `d`='".$d."' AND `m`='".$m."' AND `y`='".$y."';");
$test_id=@mysql_num_rows($sql);
$field=@mysql_fetch_array($sql);
$sql_ip_bro=$field['ip_bro'];
if($ip_bro==$sql_ip_bro){
header("Location: ".$url."");
exit;
}
$sql2 = @mysql_query("SELECT * FROM `click_opsos_mes` WHERE `uid`='".$go."' AND `m`='".$m."' AND `y`='".$y."';");
$test_id2=@mysql_num_rows($sql2);
$sql3 = @mysql_query("SELECT * FROM `click_opsos_total` WHERE `uid`='".$go."';");
$test_id3=@mysql_num_rows($sql3);
if($test_id3<1){
@mysql_query("INSERT INTO `click_opsos_total` (`uid`,`hits`,`".$oper."`) values ('".$go."','1','1')");
}
else{
@mysql_query("UPDATE `click_opsos_total` SET `hits`=`hits`+'1',`".$oper."`=`".$oper."`+'1' WHERE `uid`='".$go."'");
}
if($test_id2<1){
@mysql_query("INSERT INTO `click_opsos_mes` (`uid`,`m`,`y`,`hits`,`".$oper."`) values ('".$go."','".$m."','".$y."','1','1')");
}
else{
@mysql_query("UPDATE `click_opsos_mes` SET `hits`=`hits`+'1',`".$oper."`=`".$oper."`+'1' WHERE `uid`='".$go."' and `m`='".$m."' and `y`='".$y."'");
}
if($test_id<1){
@mysql_query("INSERT INTO `click_opsos` (`uid`,`d`,`m`,`y`,`hits`,`ip_bro`,`".$oper."`) values ('".$go."','".$d."','".$m."','".$y."','1','".$ip_bro."','1')");
@mysql_query("UPDATE `click_user` SET `vchera`=`segodnya`,`segodnya`='1' WHERE `id`='".$go."'");
}
else{
@mysql_query("UPDATE `click_opsos` SET `hits`=`hits`+'1',`ip_bro`='".$ip_bro."',`".$oper."`=`".$oper."`+'1' WHERE `uid`='".$go."' and `d`='".$d."' and `m`='".$m."' and `y`='".$y."'");
@mysql_query("UPDATE `click_user` SET `segodnya`=`segodnya`+'1' WHERE `id`='".$go."'");
}
header("Location: ".$url."");
?>