<?php
defined('NTOP') or die('Error: restricted access');

function browser(){ 
global $ua; 
if (preg_match('/opera min/i', $ua)) $browser = 'Opera Mini'; 
else if (preg_match('/Chrome/i', $ua))$browser = 'Chrome'; 
else if (preg_match('/Opera/i', $ua)) $browser = 'Opera'; 
else if (preg_match('/MSIE/i', $ua)) $browser = 'IE'; 
else if (preg_match('/Mozilla/i', $ua)) $browser = 'Mozilla'; 
else if (preg_match('/ucweb/i', $ua)) $browser = 'UCWeb'; 
else $browser = 'Неизвестно'; 
return $browser; 
}

if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) and preg_match('|^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$|',$_SERVER['HTTP_X_FORWARDED_FOR'])){
$ip = trim(htmlspecialchars(mysql_real_escape_string($_SERVER['HTTP_X_FORWARDED_FOR'])));
}elseif(isset($_SERVER['HTTP_CLIENT_IP']) and preg_match('|^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$|',$_SERVER['HTTP_CLIENT_IP'])){
$ip = trim(htmlspecialchars(mysql_real_escape_string($_SERVER['HTTP_CLIENT_IP'])));
}elseif(isset($_SERVER['REMOTE_ADDR']) and preg_match('|^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$|',$_SERVER['REMOTE_ADDR'])){
$ip = trim(htmlspecialchars(mysql_real_escape_string($_SERVER['REMOTE_ADDR'])));
}else{
$ip = 'Скрыт';
}

if (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])){
$ua = trim(htmlspecialchars(mysql_real_escape_string($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])));
}elseif (isset($_SERVER['HTTP_USER_AGENT'])){
$ua = trim(htmlspecialchars(mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])));
}else{
$ua = 'Скрыт';
}

$ua = strtok($ua, '/');
$ua = strtok($ua, ' ');
$id = isset($_GET['id']) ? abs(intval($_GET['id'])) : '';
$sait = isset($_GET['sait']) ? abs(intval($_GET['sait'])) : '';
$act = isset($_GET['act']) ? htmlspecialchars(mysql_real_escape_string($_GET['act'])) : '';
?>