Размер файла: 1.18Kb
<?php
include "init/config.php";
include "init/system.php";
$id = abs((int)$_SERVER['QUERY_STRING']);
if(empty($id)){
header ("Location: http://".$_SERVER['SERVER_NAME']);
}else{
$sql = mysql_query("SELECT `ids` FROM `cat_ip` WHERE INET_ATON('".getenv('REMOTE_ADDR')."') BETWEEN `ip1` AND `ip2`;");
if(mysql_num_rows($sql) > 0)
{
$operator = mysql_result($sql, 0);
}
else
{
$operator = 0;
}
$sql = mysql_query("SELECT * FROM `cat_opsos_out` WHERE `opsos` = '".$operator."'");
if(mysql_num_rows($sql) > 0){
$sql = mysql_query("UPDATE `cat_opsos_out` SET `out` = (`in` + 1) WHERE `opsos` = '".$operator."'");
}else{
$sql = mysql_query("INSERT INTO `cat_opsos_out` SET `ip` = INET_ATON('".getenv('REMOTE_ADDR')."'), `opsos` = '".$operator."', `date` = '".date()."', `idsite` = '".$id."', `out` = '1'");
}
$sql = mysql_query("UPDATE `cat_users` SET `out` = (`out` + 1), `outall` = (`outall` + 1) WHERE `id` = '".$id."'");
$query = mysql_query("SELECT * FROM `cat_users` WHERE `id` = '".$id."'");
$row = mysql_fetch_assoc($query);
header ("Location:http://".$row['url']);
}
?>