<?php
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && filter_var($_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP
))
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
elseif (isset($_SERVER['REMOTE_ADDR']) && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP
)) $ip = $_SERVER['REMOTE_ADDR'];
else $ip = 'Unknown';
$device = 'Mobile';
if (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])){
$device = 'Opera Mini';
}elseif(isset($_SERVER['HTTP_USER_AGENT'])){
if (!$sx ||
strpos($sx, 'windows') !== false ||
strpos($sx, 'linux') !== false ||
strpos($sx, 'bsd') !== false ||
strpos($sx, 'x11') !== false ||
strpos($sx, 'unix') !== false ||
strpos($sx, 'macintosh') !== false ||
strpos($sx, 'macos') !== false)
$device = 'Computer';
if(strpos($sx, 'yandex') !== false ||
strpos($sx, 'rambler') !== false ||
strpos($sx, 'mail') !== false ||
strpos($sx, 'google') !== false ||
strpos($sx, 'slurp') !== false ||
strpos($sx, 'msn') !== false ||
strpos($sx, 'teoma') !== false ||
strpos($sx, 'scooter') !== false ||
strpos($sx, 'ia_archiver') !== false ||
strpos($sx, 'lycos') !== false ||
strpos($sx, 'webalta') !== false ||
strpos($sx, 'aport') !== false)
$device = 'BOT';
}else $ua = 'Unknown';
?>