Вход Регистрация
Файл: functions.php
Строк: 73
<?php
#############################
#       СКРИПТ ФОРУМА       #
#           КАК НА          #
#        http://ony.su      #
# Автор : ExPLOiT           #
# ICQ   : 949-38-99         #
#############################
/*
 ! Вы не имеете права распространять данный скрипт. !
*/
include_once("connect.php");
include_once(
"config.php");
function 
ban($username$ua$ip)
 {
 global 
$modername$banmess;
    
$query mysql_query("SELECT * FROM `ban`
                          WHERE `user`='"
.$ua."'
                          OR `ip`='"
.$ip."'
                          OR `username`='"
.$username."'
                          AND `time` > UNIX_TIMESTAMP()"
);
    if(
mysql_num_rows($query))
    {
        
$rows mysql_fetch_array($query);
        
$modername $rows['moder'];
        
$banmess $rows['mess'];
        return( 
true );
    }
    else
    {
        return ( 
false );
    }
 }

function 
translate($mess)
{
$array = array(
"Jo" => "Ё",
"jo" => "ё",
"Yo" => "Ё",
"yo" => "ё",
"Zh" => "Ж",
"zh" => "ж",
"*" => "ж",
"Ch" => "Ч",
"ch" => "ч",
"Sh" => "Ш",
"sh" => "ш",
"Shc" => "Щ",
"shc" => "щ",
"''" => 'ъ',
"'" => "ь",
"Ye" => "Э",
"ye" => "э",
"Yu" => "Ю",
"yu" => "ю",
"Ya" => "Я",
"ya" => "я",
"X" => "Ы",
"x" => "ы",

"A" => "А",
"a" => "а",
"B" => "Б",
"b" => "б",
"C" => "Ц",
"c" => "ц",
"D" => "Д",
"d" => "д",
"E" => "Е",
"e" => "е",
"F" => "Ф",
"f" => "ф",
"G" => "Г",
"g" => "г",
"H" => "Х",
"h" => "х",
"I" => "И",
"i" => "и",
"K" => "К",
"k" => "к",
"L" => "Л",
"l" => "л",
"M" => "М",
"m" => "м",
"N" => "Н",
"n" => "н",
"O" => "О",
"o" => "о",
"P" => "П",
"p" => "п",
"Q" => "Ь",
"q" => "ь",
"R" => "Р",
"r" => "р",
"S" => "С",
"s" => "с",
"T" => "Т",
"t" => "т",
"U" => "У",
"u" => "у",
"V" => "В",
"v" => "в",
"W" => "Ш",
"w" => "ш",
"Y" => "Й",
"y" => "й",
"Z" => "З",
"z" => "з"
);

return (
strtr($mess$array));
}

    function 
smile($matches)
    {
    static 
$c;
    
$arr = array('&lt;1&gt;',
                   
'&lt;2&gt;',
                   
'&lt;3&gt;',
                   
'&lt;4&gt;',
                   
'&lt;5&gt;',
                   
'&lt;6&gt;',
                   
'&lt;7&gt;',
                   
'&lt;8&gt;',
                   
'&lt;9&gt;',
                   
'&lt;10&gt;',
                   
'&lt;11&gt;',
                   
'&lt;12&gt;',
                   
'&lt;13&gt;',
                   
'&lt;14&gt;',
                   
'&lt;15&gt;',
                   
'&lt;16&gt;',
                   
'&lt;17&gt;',
                   
'&lt;18&gt;',
                   
'&lt;19&gt;',
                   
'&lt;20&gt;',
                   
'&lt;21&gt;',
                   
'&lt;22&gt;',
                   
'&lt;23&gt;',
                   
'&lt;24&gt;',
                   
'&lt;25&gt;',
                   
'&lt;26&gt;',
                   
'&lt;27&gt;',
                   
'&lt;28&gt;',
                   
'&lt;29&gt;',
                   
'&lt;30&gt;',
                   
'&lt;31&gt;',
                   
'&lt;32&gt;',
                   
'&lt;33&gt;',
                   
'&lt;34&gt;',
                   
'&lt;35&gt;',
                   
'&lt;36&gt;',
                   
'&lt;37&gt;',
                   
'&lt;38&gt;'
                                        
);
        if(
$c == 1) return $matches[0];
        if(!
in_array($matches[0], $arr)) return $matches[0];

        
$c++;

        
$smiles = array(
         
"<img src='smiles/1.gif' />"
"<img src='smiles/2.gif' />"
"<img src='smiles/3.gif' />"
"<img src='smiles/4.gif' />"
"<img src='smiles/5.gif' />"
"<img src='smiles/6.gif' />"
"<img src='smiles/7.gif' />"
"<img src='smiles/8.gif' />"
"<img src='smiles/9.gif' />"
"<img src='smiles/10.gif' />"
"<img src='smiles/11.gif' />"
"<img src='smiles/12.gif' />"
"<img src='smiles/13.gif' />"
"<img src='smiles/14.gif' />"
"<img src='smiles/15.gif' />"
"<img src='smiles/16.gif' />"
"<img src='smiles/17.gif' />",
"<img src='smiles/18.gif' />"
"<img src='smiles/19.gif' />",
"<img src='smiles/20.gif' />",
"<img src='smiles/21.gif' />",
"<img src='smiles/22.gif' />",
"<img src='smiles/23.gif' />",
"<img src='smiles/24.gif' />",
"<img src='smiles/25.gif' />",
"<img src='smiles/26.gif' />",
"<img src='smiles/27.gif' />",
"<img src='smiles/28.gif' />",
"<img src='smiles/29.gif' />",
"<img src='smiles/30.gif' />",
"<img src='smiles/31.gif' />",
"<img src='smiles/32.gif' />",
"<img src='smiles/33.gif' />",
"<img src='smiles/34.gif' />",
"<img src='smiles/35.gif' />",
"<img src='smiles/36.gif' />",
"<img src='smiles/37.gif' />",
"<img src='smiles/38.gif' />"
        
);

        return 
str_replace($arr$smiles$matches[0]);
    }

    function 
username2id($username)
    {
        
$id mysql_fetch_array(mysql_query("SELECT id FROM users WHERE username='".$username."'"));
        return( 
$id['id'] );
    }

    function 
ClearOnline()
    {
        
mysql_query("DELETE FROM session WHERE time < ".(time() - (24 60 60)));
    }

    function 
RefreshLastTime($username$fid$lastMsgTime)
    {
        
mysql_query("UPDATE `counter` SET `time`=".($lastMsgTime)." WHERE `fid`=".$fid." AND `username`='".$username."'");
    }


    function 
RefreshSid($username)
    {
        
mysql_query("UPDATE `session` SET `time`=".time()." WHERE `nickname`='".$username."'");
        
mysql_query("UPDATE `users` SET `last_time`=".time()." WHERE `username`='".$username."'");
    }

     function 
topic2post($id_topic)
     {
        return(
mysql_result(mysql_query("SELECT MIN(`id`) FROM `posts` WHERE `id_theme`=".$id_topic), 0));
     }

    function 
is_author($id$user)
    {
        if(
mysql_result(mysql_query("SELECT COUNT(*) FROM `themes` WHERE `id`=".$id." AND `name`='".$user."'"), 0))
        {
            return(
true);
        }
        else
        {
            return(
false);
        }
    }

    function 
sql($str)
    {
        if(
get_magic_quotes_gpc())
        {
            
$str stripslashes($str);
        }
        return(
str_replace('$''&#36;'mysql_escape_string($str)));
    }

?>
Онлайн: 1
Реклама