Просмотр файла inc/func.php

Размер файла: 11.1Kb
<?php

function data()
{
    $data = date("d-m-y", time());
    // $data=explode('/', $data);
    /*switch($data[1]){
 case "1":
  $data[1]='Января';
  break;
 case "2":
  $data[1]='Февраля';
  break;
 case "3":
  $data[1]='Марта';
  break;
 case "4":
  $data[1]='Апреля';
  break;
 case "5":
  $data[1]='Мая';
  break;
 case "6":
  $data[1]='Июня';
  break;
 case "7":
  $data[1]='Июля';
  break;
 case "8":
  $data[1]='Августа';
  break;
 case "9":
  $data[1]='Сентября';
  break;
 case "10":
  $data[1]='Октября';
  break;
 case "11":
  $data[1]='Ноября';
  break;
 case "12":
  $data[1]='Декабря';
  break;
 default: header("Location:game.php"); break;
 }*/
    // $data=implode(' ', $data);
    return $data;
} 

function vrem ()
{
    $vrem = date("H:i:s", time());
    return $vrem;
} 

function brow()
{
    if ($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) {
        $brow = htmlspecialchars(stripslashes($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']));
    } else {
        $brow = htmlspecialchars(stripslashes($_SERVER['HTTP_USER_AGENT']));
    } 
    $brow = strtok($brow, '(');
    $brow = strtok($brow, ' ');
    $brow = substr($brow, 0, 22);
    $brow = str_replace("http://", "", $brow);
    return $brow;
} 

function ip()
{
    if ($_SERVER['HTTP_X_FORWARDED_FOR']) $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    else if ($_SERVER['HTTP_CLIENT_IP']) $ip = $_SERVER['HTTP_CLIENT_IP'];
    else if ($_SERVER['REMOTE_ADDR']) $ip = $_SERVER['REMOTE_ADDR'];
    else {
        $ip = 'Не определён';
    } 
    $ip = preg_replace("/[^0-9.]/", "", $ip);
    $ip = htmlspecialchars(stripslashes($ip));
    return $ip;
} 

function smile($text)
{
    $text = str_replace('0:-)', '<img src="/img/smiles/aa.gif">', $text);
    $text = str_replace('O:-)', '<img src="/img/smiles/aa.gif">', $text);
    $text = str_replace(':-)', '<img src="/img/smiles/ab.gif">', $text);
    $text = str_replace(':)', '<img src="/img/smiles/ab.gif">', $text);
    $text = str_replace(':-(', '<img src="/img/smiles/ac.gif">', $text);
    $text = str_replace(':(', '<img src="/img/smiles/ac.gif">', $text);
    $text = str_replace(';)', '<img src="/img/smiles/ad.gif">', $text);
    $text = str_replace(';-)', '<img src="/img/smiles/ad.gif">', $text);
    $text = str_replace(':P', '<img src="/img/smiles/ae.gif">', $text);
    $text = str_replace(':p', '<img src="/img/smiles/ae.gif">', $text);
    $text = str_replace(':-P', '<img src="/img/smiles/ae.gif">', $text);
    $text = str_replace(':-p', '<img src="/img/smiles/ae.gif">', $text);
    $text = str_replace('8)', '<img src="/img/smiles/af.gif">', $text);
    $text = str_replace('8-)', '<img src="/img/smiles/af.gif">', $text);
    $text = str_replace(':D', '<img src="/img/smiles/ag.gif">', $text);
    $text = str_replace(':-D', '<img src="/img/smiles/ag.gif">', $text);
    $text = str_replace(':-[', '<img src="/img/smiles/ah.gif">', $text);
    $text = str_replace(':[', '<img src="/img/smiles/ah.gif">', $text);
    $text = str_replace('=-0', '<img src="/img/smiles/ai.gif">', $text);
    $text = str_replace('=0', '<img src="/img/smiles/ai.gif">', $text);
    $text = str_replace('=-O', '<img src="/img/smiles/ai.gif">', $text);
    $text = str_replace('=O', '<img src="/img/smiles/ai.gif">', $text);
    $text = str_replace(':-*', '<img src="/img/smiles/aj.gif">', $text);
    $text = str_replace(':*', '<img src="/img/smiles/aj.gif">', $text);
    $text = str_replace(":'(", '<img src="/img/smiles/ak.gif">', $text);
    $text = str_replace(":'-(", '<img src="/img/smiles/ak.gif">', $text);
    $text = str_replace(':X', '<img src="/img/smiles/al.gif">', $text);
    $text = str_replace(':-X', '<img src="/img/smiles/al.gif">', $text);
    $text = str_replace('&gt;:0', '<img src="/img/smiles/am.gif">', $text);
    $text = str_replace('&gt;0', '<img src="/img/smiles/am.gif">', $text);
    $text = str_replace(':-|', '<img src="/img/smiles/an.gif">', $text);
    $text = str_replace(':|', '<img src="/img/smiles/an.gif">', $text);
    $text = str_replace(':ggg:', '<img src="/img/smiles/ap.gif">', $text);
    $text = str_replace(':GGG:', '<img src="/img/smiles/ap.gif">', $text);
    $text = str_replace(']:-&gt;', '<img src="/img/smiles/aq.gif">', $text);
    $text = str_replace(':devil:', '<img src="/img/smiles/aq.gif">', $text);
    $text = str_replace('[:-}', '<img src="/img/smiles/ar.gif">', $text);
    $text = str_replace(':music:', '<img src="/img/smiles/ar.gif">', $text);
    $text = str_replace(':kiss:', '<img src="/img/smiles/as.gif">', $text);
    $text = str_replace(':KISS:', '<img src="/img/smiles/ap.gif">', $text);
    $text = str_replace(':-!', '<img src="/img/smiles/at.gif">', $text);
    $text = str_replace(':!', '<img src="/img/smiles/at.gif">', $text);
    $text = str_replace(':tired:', '<img src="/img/smiles/au.gif">', $text);
    $text = str_replace(':TIRED:', '<img src="/img/smiles/au.gif">', $text);
    $text = str_replace(':stop:', '<img src="/img/smiles/av.gif">', $text);
    $text = str_replace(':STOP:', '<img src="/img/smiles/av.gif">', $text);
    $text = str_replace(':kissing:', '<img src="/img/smiles/aw.gif">', $text);
    $text = str_replace(':KISSING:', '<img src="/img/smiles/aw.gif">', $text);
    $text = str_replace(':rose:', '<img src="/img/smiles/ax.gif">', $text);
    $text = str_replace(':ROSE:', '<img src="/img/smiles/ax.gif">', $text);
    $text = str_replace(':up:', '<img src="/img/smiles/ay.gif">', $text);
    $text = str_replace(':UP:', '<img src="/img/smiles/ay.gif">', $text);
    $text = str_replace(':drink:', '<img src="/img/smiles/az.gif">', $text);
    $text = str_replace(':DRINK:', '<img src="/img/smiles/az.gif">', $text);
    $text = str_replace(':love:', '<img src="/img/smiles/ba.gif">', $text);
    $text = str_replace(':LOVE:', '<img src="/img/smiles/ba.gif">', $text);
    $text = str_replace(':bomb:', '<img src="/img/smiles/bb.gif">', $text);
    $text = str_replace(':BOMB:', '<img src="/img/smiles/bb.gif">', $text);
    $text = str_replace(':help:', '<img src="/img/smiles/bc.gif">', $text);
    $text = str_replace(':HELP:', '<img src="/img/smiles/bc.gif">', $text);
    $text = str_replace(':krut:', '<img src="/img/smiles/bd.gif">', $text);
    $text = str_replace(':KRUT:', '<img src="/img/smiles/bd.gif">', $text);
    $text = str_replace('%)', '<img src="/img/smiles/be.gif">', $text);
    $text = str_replace(':ok:', '<img src="/img/smiles/bf.gif">', $text);
    $text = str_replace(':OK:', '<img src="/img/smiles/bf.gif">', $text);
    $text = str_replace(':sorry:', '<img src="/img/smiles/bh.gif">', $text);
    $text = str_replace(':SORRY:', '<img src="/img/smiles/bh.gif">', $text);
    $text = str_replace(':bravo:', '<img src="/img/smiles/bi.gif">', $text);
    $text = str_replace(':BRAVO:', '<img src="/img/smiles/bi.gif">', $text);
    $text = str_replace(':rofl:', '<img src="/img/smiles/bj.gif">', $text);
    $text = str_replace(':ROFL:', '<img src="/img/smiles/bj.gif">', $text);
    $text = str_replace(':pardon:', '<img src="/img/smiles/bk.gif">', $text);
    $text = str_replace(':PARDON:', '<img src="/img/smiles/bk.gif">', $text);
    $text = str_replace(':no:', '<img src="/img/smiles/bl.gif">', $text);
    $text = str_replace(':NO:', '<img src="/img/smiles/bl.gif">', $text);
    $text = str_replace(':crazy:', '<img src="/img/smiles/bm.gif">', $text);
    $text = str_replace(':CRAZY:', '<img src="/img/smiles/bm.gif">', $text);
    $text = str_replace(':xz:', '<img src="/img/smiles/bn.gif">', $text);
    $text = str_replace(':XZ:', '<img src="/img/smiles/bn.gif">', $text);
    $text = str_replace(':dance:', '<img src="/img/smiles/bo.gif">', $text);
    $text = str_replace(':DANCE:', '<img src="/img/smiles/bo.gif">', $text);
    $text = str_replace(':yahoo:', '<img src="/img/smiles/bp.gif">', $text);
    $text = str_replace(':YAHOO:', '<img src="/img/smiles/bp.gif">', $text);
    $text = str_replace(':hello:', '<img src="/img/smiles/bq.gif">', $text);
    $text = str_replace(':HELLO:', '<img src="/img/smiles/bq.gif">', $text);
    $text = str_replace(':bye:', '<img src="/img/smiles/br.gif">', $text);
    $text = str_replace(':BYE:', '<img src="/img/smiles/br.gif">', $text);
    $text = str_replace(':yes:', '<img src="/img/smiles/bs.gif">', $text);
    $text = str_replace(':YES:', '<img src="/img/smiles/bs.gif">', $text);
    $text = str_replace(':apstena:', '<img src="/img/smiles/bu.gif">', $text);
    $text = str_replace(':APSTENA:', '<img src="/img/smiles/bu.gif">', $text);
    $text = str_replace(':write:', '<img src="/img/smiles/bv.gif">', $text);
    $text = str_replace(':WRITE:', '<img src="/img/smiles/bv.gif">', $text);
    return $text;
} 

$leveldir = "";
while (!file_exists($leveldir . "config.php")) {
    $leveldir .= "../";
} 
define("BASE", $leveldir);

function utf_to_win($str)
{
    $str = strtr($str, array("Р°" => "а", "Р±" => "б", "РІ" => "в", "Рі" => "г", "Рґ" => "д", "Рµ" => "е", "С‘" => "ё", "Р¶" => "ж", "Р·" => "з", "Рё" => "и", "Р№" => "й", "Рє" => "к", "Р»" => "л", "Рј" => "м", "РЅ" => "н", "Рѕ" => "о", "Рї" => "п", "СЂ" => "р", "СЃ" => "с", "С‚" => "т", "Сѓ" => "у", "С„" => "ф", "С…" => "х", "С†" => "ц", "С‡" => "ч", "С€" => "ш", "С‰" => "щ", "СЉ" => "ъ", "С‹" => "ы", "СЊ" => "ь", "СЌ" => "э", "СЋ" => "ю", "СЏ" => "я",
            "Рђ" => "А", "Р‘" => "Б", "Р’" => "В", "Р“" => "Г", "Р”" => "Д", "Р•" => "Е", "РЃ" => "Ё", "Р–" => "Ж", "Р—" => "З", "И" => "И", "Р™" => "Й", "Рљ" => "К", "Р›" => "Л", "Рњ" => "М", "Рќ" => "Н", "Рћ" => "О", "Рџ" => "П", "Р " => "Р", "РЎ" => "С", "Рў" => "Т", "РЈ" => "У", "Р¤" => "Ф", "РҐ" => "Х", "Р¦" => "Ц", "Р§" => "Ч", "РЁ" => "Ш", "Р©" => "Щ", "РЄ" => "Ъ", "Р«" => "Ы", "Р¬" => "Ь", "Р­" => "Э", "Р®" => "Ю", "РЇ" => "Я"));
    return $str;
} 

function win_to_utf($str)
{
    $str = strtr($str, array("а" => "Р°", "б" => "Р±", "в" => "РІ", "г" => "Рі", "д" => "Рґ", "е" => "Рµ", "ё" => "С‘", "ж" => "Р¶", "з" => "Р·", "и" => "Рё", "й" => "Р№", "к" => "Рє", "л" => "Р»", "м" => "Рј", "н" => "РЅ", "о" => "Рѕ", "п" => "Рї", "р" => "СЂ", "с" => "СЃ", "т" => "С‚", "у" => "Сѓ", "ф" => "С„", "х" => "С…", "ц" => "С†", "ч" => "С‡", "ш" => "С€", "щ" => "С‰", "ъ" => "СЉ", "ы" => "С‹", "ь" => "СЊ", "э" => "СЌ", "ю" => "СЋ", "я" => "СЏ",
            "А" => "Рђ", "Б" => "Р‘", "В" => "Р’", "Г" => "Р“", "Д" => "Р”", "Е" => "Р•", "Ё" => "РЃ", "Ж" => "Р–", "З" => "Р—", "И" => "И", "Й" => "Р™", "К" => "Рљ", "Л" => "Р›", "М" => "Рњ", "Н" => "Рќ", "О" => "Рћ", "П" => "Рџ", "Р" => "Р ", "С" => "РЎ", "Т" => "Рў", "У" => "РЈ", "Ф" => "Р¤", "Х" => "РҐ", "Ц" => "Р¦", "Ч" => "Р§", "Ш" => "РЁ", "Щ" => "Р©", "Ъ" => "РЄ", "Ы" => "Р«", "Ь" => "Р¬", "Э" => "Р­", "Ю" => "Р®", "Я" => "РЇ"));
    return $str;
} 

?>