<?php
function get_user_ip( )
{
$_obfuscate_H0g7NwzK0Vcx_2gя = $_SERVER['REMOTE_ADDR'];
if ( $_obfuscate_H0g7NwzK0Vcx_2gя )
{
$_obfuscate_H0g7NwzK0Vcx_2gя = urldecode( getenv( "HTTP_CLIENTIP" ) );
}
if ( getenv( "HTTP_X_FORWARDED_FOR" ) )
{
$_obfuscate_dAd86p0я = getenv( "HTTP_X_FORWARDED_FOR" );
}
else if ( getenv( "HTTP_X_FORWARDED" ) )
{
$_obfuscate_dAd86p0я = getenv( "HTTP_X_FORWARDED" );
}
else if ( getenv( "HTTP_FORWARDED_FOR" ) )
{
$_obfuscate_dAd86p0я = getenv( "HTTP_FORWARDED_FOR" );
}
else if ( getenv( "HTTP_FORWARDED" ) )
{
$_obfuscate_dAd86p0я = getenv( "HTTP_FORWARDED" );
}
else
{
$_obfuscate_dAd86p0я = $_SERVER['REMOTE_ADDR'];
}
if ( $_obfuscate_H0g7NwzK0Vcx_2gя != $_obfuscate_dAd86p0я )
{
$_obfuscate_dAd86p0я = $_obfuscate_H0g7NwzK0Vcx_2gя.", ".$_obfuscate_dAd86p0я;
}
return $_obfuscate_dAd86p0я;
}
@require( "data/config.php" );
if ( !( $connection = @mysql_connect( $db_host, $db_user, $db_pass ) ) )
{
exit( "Невозможно подключиться к базе данных!" );
}
if ( !@mysql_select_db( $db_name ) )
{
exit( "Не могу выбрать базу данных " );
}
$id = $_GET['id'];
$result4 = @mysql_query( @"SELECT id from ".$userstable12." where id='{$id}'" );
$rec = mysql_num_rows( $result4 );
if ( $rec == 0 )
{
echo "Неверно заданы параметры перенаправления. Воспользуйтесь кнопкой \"назад\" Вашего браузера.";
exit( );
}
$id_chanal = $_GET['id_chanal'];
$visit_number = 1;
@$coo = @$_COOKIE["id_record_stat_".@$id];
if ( isset( $coo ) & $coo != "fin" )
{
//$visit = split( "#", $coo )[1];
//$id_record_stat = split( "#", $coo )[0];
$coo_arr = split('#', $coo);
$visit = $coo_arr[1];
$id_record_stat = $coo_arr[0];
++$visit;
$visit_number = $visit;
}
else if ( isset( $coo ) & $coo == "fin" )
{
$visit_number = "fin";
}
@$date = @date( @Y."-".@m."-".@d );
@$time = @date( @H.":".@i.":".@s );
@$url_from = @$_SERVER['HTTP_REFERER'];
preg_match( "/^(?:http:\\/\\/)([-._a-z0-9]*)[\\/][^\\s]*$/", $url_from, $domen );
@$domen_from = @$domen[1];
if ( empty( $url_from ) )
{
$url_from = "n/a";
}
if ( empty( $domen_from ) )
{
$domen_from = "n/a";
}
$ip = get_user_ip( );
$ip = trim( $ip );
if ( empty( $ip ) )
{
$ip = "blocked";
}
$pr = 0;
@require( "iplist.php" );
if ( $pr == 0 )
{
$n = getenv( "HTTP_USER_AGENT" );
$n2 = $n;
@require( "botlist.php" );
if ( $n == $n2 )
{
$result2 = @mysql_query( @"INSERT INTO ".$userstable17." VALUES ('', '{$id}', '{$domen_from}', '{$url_from}', '{$date}', '{$ip}', '{$visit_number}', '{$id_chanal}', '{$time}', 'n' )" );
$result4 = mysql_query( "SELECT id from ".$userstable17." where id_url='{$id}' && ip='{$ip}' && `date`='{$date}' && `time`='{$time}'" );
$data_red4 = mysql_fetch_array( $result4 );
$id_record_stat = $data_red4['id'];
if ( !isset( $coo ) || $coo != "fin" )
{
setcookie( "id_record_stat_".$id, $id_record_stat."#".$visit_number, time( ) + 31536000 );
}
}
}
$result3 = @mysql_query( @"SELECT url from ".$userstable12." where id='{$id}'" );
$data_red3 = mysql_fetch_array( $result3 );
$url = $data_red3['url'];
header( sprintf( "Location: ".$url."" ) );
?>