Файл: minichat_by_KoT/minichat_by_KoT/ip_ua.php
Строк: 7
<?php
##########################################
# ~ Разработка отдельных модулей ~~~~~~~ #
# ~ и написание скриптов на php (c)KoT ~ #
# ~ ICQ: 7675072 ~~~~~~~~~~~~~~~~~~~~~~~ #
# ~ Site: 4atlove.ru ~~~~~~~~~~~~~~~~~~~ #
# ~ E-mail: notefree@bk.ru ~~~~~~~~~~~~~ #
##########################################
$ip = false;
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '127.0.0.1' && ereg("^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})$", $_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip2['xff'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
$ipa[] = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != '127.0.0.1' && ereg("^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})$", $_SERVER['HTTP_CLIENT_IP']))
{
$ip2['cl'] = $_SERVER['HTTP_CLIENT_IP'];
$ipa[] = $_SERVER['HTTP_CLIENT_IP'];
}
if (isset($_SERVER['REMOTE_ADDR']) && ereg("^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})$", $_SERVER['REMOTE_ADDR']))
{
$ip2['add'] = $_SERVER['REMOTE_ADDR'];
$ipa[] = $_SERVER['REMOTE_ADDR'];
}
$ip = $ipa[0];
$iplong = ip2long($ip);
if (isset($_SERVER['HTTP_USER_AGENT']))
{
$ua = $_SERVER['HTTP_USER_AGENT'];
$ua = strtok($ua, '/');
$ua = strtok($ua, '(');
$ua = eregi_replace('[^a-z_./ 0-9-]', null, $ua);
if (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) && ereg('Opera', $ua))
{
$ua_om = $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'];
$ua_om = strtok($ua_om, '/');
$ua_om = strtok($ua_om, '(');
$ua_om = eregi_replace('[^a-z_. 0-9-]', null, $ua_om);
$ua = 'Opera Mini ('.$ua_om.')';
}
}
else $ua = 'Нет данных';
?>