Файл: imstat.ru/go.php
Строк: 32
<?php
define('NTOP', 1);
require_once('system/connect.php');
require_once('system/core.php');
require_once('system/function.php');
$isset = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `id` = '".$id."'");
if($id && $id != 0){
$top = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' ORDER BY `hosts` DESC");
$page = ceil($top/$page_top);
}elseif(mysql_num_rows($isset) == 0){
header('Location: /index.php');
}else{
header('Location: /index.php');
}
$ips = explode('.', $_SERVER['REMOTE_ADDR']);
$ipnum = $ips[3] + $ips[2] * 256 + $ips[1] * 256 * 256 + $ips[0] * 256 * 256 * 256;
$oper = mysql_result(mysql_query ("SELECT `on` FROM `ip` WHERE $ipnum BETWEEN `ip`.`min` AND `ip`.`max` LIMIT 1"),0);
$proverka = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."go` WHERE `ip` = '".$ip."' AND `id_sait` = '".$id."' AND `type` = 'in' AND `time` > '".(time()-86400)."'"));
$sait = mysql_fetch_array($isset);
if($proverka == 0 && $oper == 1){
mysql_query("INSERT INTO `".$prefix."go` SET `id_sait` = '".$id."', `type` = 'in', `ip` = '".$ip."', `time` = '".time()."'");
mysql_query("UPDATE `".$prefix."sait` SET `in` = (`in` + 1), `all_in` = (`all_in` + 1) WHERE `id` = '".$id."'");
mysql_query("UPDATE `".$prefix."users` SET `in` = (`in` + 1) WHERE `id` = '".$user_data['id']."'");
mysql_query("UPDATE `".$prefix."users` SET `kr` = (`kr` + 1) WHERE `id` = '".$sait['id_user']."'");
}
if($sait['status'] == 1 && $sait['category'] != 4){
header('Location: /index.php?id='.$id.'');
}elseif($sait['category'] == 4 && $sait['status'] == 1){
header('Location: /str/cat.php?act=view&id=4&sait='.$id.'');
}else{
header('Location: /str/cat.php?act=mod&id='.$id.'');
}
?>