Просмотр файла ICQ_distribution/fun.php

Размер файла: 3.18Kb
<?php
/*
=>Автор: Демидов Анатолий aka lugaro
=>ICQ: 2000882
=>E-mail: [email protected]
=>Сайт: http://wphp.ru
=>Категория скрипта: ПЛАТНЫЙ
---------------------------------
Внимание! Распространять скрип ЗАПРЕЩЕННО! А тем более продавать!
Уважайте авторское право!
-
Спасибо Vantuz'у за полезные функции с WAP-MOTOR'a
visavi.net
*/
$_utf8win1251 = array( 
"\xD0\x90"=>"\xC0","\xD0\x91"=>"\xC1","\xD0\x92"=>"\xC2","\xD0\x93"=>"\xC3","\xD0\x94"=>"\xC4", 
"\xD0\x95"=>"\xC5","\xD0\x81"=>"\xA8","\xD0\x96"=>"\xC6","\xD0\x97"=>"\xC7","\xD0\x98"=>"\xC8", 
"\xD0\x99"=>"\xC9","\xD0\x9A"=>"\xCA","\xD0\x9B"=>"\xCB","\xD0\x9C"=>"\xCC","\xD0\x9D"=>"\xCD", 
"\xD0\x9E"=>"\xCE","\xD0\x9F"=>"\xCF","\xD0\xA0"=>"\xD0","\xD0\xA1"=>"\xD1","\xD0\xA2"=>"\xD2", 
"\xD0\xA3"=>"\xD3","\xD0\xA4"=>"\xD4","\xD0\xA5"=>"\xD5","\xD0\xA6"=>"\xD6","\xD0\xA7"=>"\xD7", 
"\xD0\xA8"=>"\xD8","\xD0\xA9"=>"\xD9","\xD0\xAA"=>"\xDA","\xD0\xAB"=>"\xDB","\xD0\xAC"=>"\xDC", 
"\xD0\xAD"=>"\xDD","\xD0\xAE"=>"\xDE","\xD0\xAF"=>"\xDF","\xD0\x87"=>"\xAF","\xD0\x86"=>"\xB2", 
"\xD0\x84"=>"\xAA","\xD0\x8E"=>"\xA1","\xD0\xB0"=>"\xE0","\xD0\xB1"=>"\xE1","\xD0\xB2"=>"\xE2", 
"\xD0\xB3"=>"\xE3","\xD0\xB4"=>"\xE4","\xD0\xB5"=>"\xE5","\xD1\x91"=>"\xB8","\xD0\xB6"=>"\xE6", 
"\xD0\xB7"=>"\xE7","\xD0\xB8"=>"\xE8","\xD0\xB9"=>"\xE9","\xD0\xBA"=>"\xEA","\xD0\xBB"=>"\xEB", 
"\xD0\xBC"=>"\xEC","\xD0\xBD"=>"\xED","\xD0\xBE"=>"\xEE","\xD0\xBF"=>"\xEF","\xD1\x80"=>"\xF0", 
"\xD1\x81"=>"\xF1","\xD1\x82"=>"\xF2","\xD1\x83"=>"\xF3","\xD1\x84"=>"\xF4","\xD1\x85"=>"\xF5", 
"\xD1\x86"=>"\xF6","\xD1\x87"=>"\xF7","\xD1\x88"=>"\xF8","\xD1\x89"=>"\xF9","\xD1\x8A"=>"\xFA", 
"\xD1\x8B"=>"\xFB","\xD1\x8C"=>"\xFC","\xD1\x8D"=>"\xFD","\xD1\x8E"=>"\xFE","\xD1\x8F"=>"\xFF", 
"\xD1\x96"=>"\xB3","\xD1\x97"=>"\xBF","\xD1\x94"=>"\xBA","\xD1\x9E"=>"\xA2"); 

function utf_to_win($a) { 
global $_utf8win1251; 
if (is_array($a)){ 
foreach ($a as $k => $v) { 
if (is_array($v)) { 
$a[$k] = utf_to_win($v); 
} else { 
$a[$k] = strtr($v, $_utf8win1251); 
}} 
return $a; 
} else { 
return strtr($a, $_utf8win1251); 
}}
###
function xss($var){
return mysql_escape_string(stripslashes(htmlspecialchars($var)));}

if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match("|^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$|", $_SERVER['HTTP_X_FORWARDED_FOR'])){
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];}
elseif(isset($_SERVER['HTTP_CLIENT_IP']) && preg_match("|^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$|", $_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];}
else {$ip = preg_replace("|[^0-9.]|", "", $_SERVER['REMOTE_ADDR']);}
$ip=htmlspecialchars($ip);

if (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])) {$browsus = htmlspecialchars(stripslashes($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']));}
elseif(isset($_SERVER['HTTP_USER_AGENT'])) {$browsus=htmlspecialchars(stripslashes($_SERVER['HTTP_USER_AGENT']));} 
else {$browsus='Not_detected';}
$brow=preg_replace('|http://|i','', $browsus);
$brow=strtok($brow,'(');
$brow=strtok($brow,' ');
$brow=substr($brow,0,22);
$brow=htmlspecialchars($brow);

?>