Просмотр файла catalogdeep/in.php

Размер файла: 1.07Kb
<?php
include "init/config.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_in` WHERE `opsos` = '".$operator."'");
if(mysql_num_rows($sql) > 0){
	$sql = mysql_query("UPDATE `cat_opsos_in` SET `in` = (`in` + 1) WHERE `opsos` = '".$operator."'");
	}else{
$sql = mysql_query("INSERT INTO `cat_opsos_in` SET `ip` = INET_ATON('".getenv('REMOTE_ADDR')."'), `opsos` = '".$operator."', `date` = '".date()."', `idsite` = '".$id."', `in` = '1'");
	}							
$sql = mysql_query("UPDATE `cat_users` SET `in` = (`in` + 1), `inall` = (`inall` + 1), `status` = 'on' WHERE `id` = '".$id."'");
	header ("Location: http://".$_SERVER['SERVER_NAME']);

}
?>