View file out.php

File size: 1.78Kb
<?php
include 'verh.php';

$id=intval($_REQUEST['id']);

$sql=mysql_query("SELECT * FROM inet_ip WHERE ip='$_SERVER[REMOTE_ADDR]' AND id_site='$id' LIMIT 1");



//Определяем оператора
$sql=mysql_query("SELECT operator FROM inet_diapozon WHERE
INET_ATON('$_SERVER[REMOTE_ADDR]') >= start AND
INET_ATON('$_SERVER[REMOTE_ADDR]') <= finish LIMIT 1");

if(mysql_num_rows($sql)==0) {
	$id_operator=0;
} else {
	$id_operator=mysql_result($sql,0,'operator');
}

      //$id_operator = mt_rand(1,26);
 //Узнаём мобильный телефон
$agent = @$_SERVER['HTTP_USER_AGENT'];
if (strpos($agent, "/")>0) {
	$agent = substr($agent,0,strpos($agent, "/"));
}
$agent=strtoupper($agent);
if (stristr($agent, "ERICSSON")) $name=1;
if (stristr($agent, "SONYERICSSON")) $name=2;
if (stristr($agent, "NOKIA")) $name=3;
if (stristr($agent, "SAMSUNG") || stristr($agent, "SEC-")) $name=4;
if (stristr($agent, "SIE")) $name=5;
if (stristr($agent, "MOT")) $name=6;
if (stristr($agent, "LG ") || stristr($agent, "LG-")) $name=7;
if (stristr($agent, "SHARP")) $name=8;
if (stristr($agent, "ALCATEL")) $name=9;
if (stristr($agent, "PANASONIC")) $name=10;
if (stristr($agent, "SAGEM")) $name=11;
if (stristr($agent, "PANTECH")) $name=12;
if (stristr($agent, "NEC")) $name=13;
if (stristr($agent, "BENQ")) $name=14;
if (stristr($agent, "Opera Mini")) $name=15;
if(!@$name) $name=0;

           //$name = mt_rand(1,15);
	//mysql_query("INSERT INTO inet_ip SET id_site='$id', ip='$_SERVER[REMOTE_ADDR]'");
	mysql_query("INSERT INTO inet_out VALUES(NULL,'$id',NOW(),'$id_operator','$name')");
	mysql_query("UPDATE inet_sites SET `out`=`out`+1, `all_out`=`all_out`+1 WHERE id='$id'");


list($url)=mysql_fetch_row(mysql_query("SELECT url FROM inet_sites WHERE id='$id'"));
header("Location: $url");

include 'niz.php';
?>