Файл: 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('<1>',
'<2>',
'<3>',
'<4>',
'<5>',
'<6>',
'<7>',
'<8>',
'<9>',
'<10>',
'<11>',
'<12>',
'<13>',
'<14>',
'<15>',
'<16>',
'<17>',
'<18>',
'<19>',
'<20>',
'<21>',
'<22>',
'<23>',
'<24>',
'<25>',
'<26>',
'<27>',
'<28>',
'<29>',
'<30>',
'<31>',
'<32>',
'<33>',
'<34>',
'<35>',
'<36>',
'<37>',
'<38>'
);
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('$', '$', mysql_escape_string($str)));
}
?>