Файл: profi_wm/system/functions.php
Строк: 427
<?
// ЛУЧШИЕ СКРИПТЫ ТОЛЬКО НА 4MAST.RU
// АВТОР Chainsaw
// ТОЛЬКО ЭКСКЛЮЗИВНЫЕ СКРИПТЫ
function err($var) {
if (!empty($var)) echo '<div class="post1"><b>'.$var.'</b></div>';
}
function user_inf($ref = NULL, $w = NULL){
global $dbs;
if (isset($ref)) $ref = TextGuard($ref);
if (!ctype_digit($ref)){
$lowuser = mb_strtolower($ref, 'UTF8');
$result = core::$dbs->query("SELECT * FROM `user` WHERE `login` = ? LIMIT 1",array($lowuser));
} elseif (ctype_digit($ref)) {
$ref = abs(intval($ref));
$result = core::$dbs->query("SELECT * FROM `user` WHERE `id` = ? LIMIT 1",array($ref));
}
$nik = $result->fetch();
if ($w == NULL) return $nik['id'];
else return $nik[$w];
}
function quickcode() {
echo '<a href="#form" onclick="javascript:tag('[url=]', '[/url]');"><img src="' . H2 . 'icons/editor/a.gif" alt="url" /></a>';
echo '<a href="#form" onclick="javascript:tag('[b]', '[/b]');"><img src="' . H2 . 'icons/editor/b.gif" alt="b" /></a>';
echo '<a href="#form" onclick="javascript:tag('[i]', '[/i]');"><img src="' . H2 . 'icons/editor/i.gif" alt="i" /></a>';
echo '<a href="#form" onclick="javascript:tag('[u]', '[/u]');"><img src="' . H2 . 'icons/editor/u.gif" alt="u" /></a>';
echo '<a href="#form" onclick="javascript:tag('[img]', '[/img]');"><img src="' . H2 . 'icons/editor/img.gif" alt="hide" /></a>';
}
// Функция вывода быстрых смайлов
function quicksmiles() {
echo '<a href="#form" onclick="javascript:tag(' :) ', '');"><img src="' . H2 . 'smiles/smile_s_1408884797" alt=":)" /></a> ';
echo '<a href="#form" onclick="javascript:tag(' :( ', '');"><img src="' . H2 . 'smiles/smile_s_1411822619" alt=":(" /></a> ';
echo '<a href="#form" onclick="javascript:tag(' :D ', '');"><img src="' . H2 . 'smiles/smile_s_1408884589" alt=":E" /></a> ';
echo '<a href="#form" onclick="javascript:tag(' =)) ', '');"><img src="' . H2 . 'smiles/smile_s_1408884611" alt=":E" /></a> ';
echo '<a href="#form" onclick="javascript:tag(' 8-) ', '');"><img src="' . H2 . 'smiles/smile_s_1408884722" alt="cry" /></a> ';
echo '<a href="#form" onclick="javascript:tag(' ;-) ', '');"><img src="' . H2 . 'smiles/smile_s_1408884906" alt="obana" /></a> ';
echo '<a href="#form" onclick="javascript:tag(' 0_0 ', '');"><img src="' . H2 . 'smiles/smile_s_1408884848" alt="0_0" /></a> ';
}
//Вспомогательная функция быстрой вставки
function quickpaste($form) {
echo '<script language="JavaScript" type="text/javascript">
function tag(text1, text2) {
if ((document.selection)) {
document.form.' . $form . '.focus();
document.form.document.selection.createRange().text = text1+document.form.document.selection.createRange().text+text2;
} else if(document.forms['form'].elements['' . $form . ''].selectionStart!=undefined) {
var element = document.forms['form'].elements['' . $form . ''];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
} else document.form.' . $form . '.value += text1+text2;
}
</script>';
}
function NewYear(){
if(date('n') == 06){
$s = mktime(0, 0, 0, 20, 06, date('y') + 1) - time();
$d = floor($s/86400);
$s = $s-($d*86400);
$h = floor($s/3600);
$s = $s-($h*3600);
$m = floor($s/60);
$s = $s-($m*60);
$time = FALSE;
if($d >= 1) $time .= $d .' дн. ';
if($h >= 1) $time .= $h .' час. ';
if($m >= 1) $time .= $m .' мин. ';
if($s >= 1) $time .= $s .' сек.';
$res = 'До Дня Рождения Матрицы: '. $time;
}
else if(date('n') == 1 && date('d') < 7) $res = 'С днем Ангела,Алиса';
else $res = FALSE;
return '<div class="post2">'.$res.' <img src="/images/elka.gif" alt="*"/></div>';
}
/* фильтрация цифр */
function num($var){
return abs(intval($var));
}
/* Вывод рекламы */
function ads(){
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl">';
while($rek2 = mysql_fetch_assoc($rek)){
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '<img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a><br/>';
echo '</div>';
echo '</div>';
}
function navig($link){
global $p,$cp;
echo '<div class="levo">Стр. ';
if($p-2>0) echo ' <a href="'.$link.'p=1"><<</a> ';
if($p-1>0) echo '<a href="'.$link.'p='.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="'.$link.'p='.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="'.$link.'p='.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="'.$link.'p='.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="'.$link.'p='.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="'.$link.'p='.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="'.$link.'p='.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="'.$link.'p='.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="'.$link.'p='.$cp.'">>></a>';
echo '</div>';
}
function size($size){
if($size >= 1073741824)
$size = round($size/1073741824*100) / 100 .' Gb';
elseif($size >= 1048576)
$size = round($size/1048576*100) / 100 .' Мб';
elseif($size >= 1024)
$size = round($size/1024*100) / 100 .' кб';
else $size = round($size).' б';
return $size;
}
function error($var){
if(!empty($var)){
echo '<div class="post2">'.$var.'</div>';
}
}
function highlight($code)
{
$code = strtr($code, array('<br />' => "rn", '<br/>' => "rn", '<' => '<', '>' => '>', '&' => '&', '$' => '$', '"' => '"', ''' => "'", '\' => '\', '`' => '`', '%' => '%', '^' => '^'));
if (!strpos($code, '<?') && mb_substr($code, 0, 2, 'UTF-8') != '<?')
{
$code = "<?phprn" . trim($code) . "rn?>";
}
$code = highlight_string($code, true);
$code = strtr($code, array('<br />' => "rn", '<br/>' => "rn"));
$code = preg_replace('|( {2,})|', "rn1", $code);
$codeline = explode("rn", $code);
foreach($codeline as $line => $string)
{
if ($string != '')
{
$ret .= '<li> ' . trim($string) . '</li>';
}
}
$code = strtr($ret, array("rn" => '<br />', "rn" => '<br/>'));
#$code = strtr($ret, array('$' => '$', '\' => '\', '`' => '`', '%' => '%', '^' => '^'));
return '<div class="code"><ol>' . $code . '</ol></div>';
}
function utf_to_win($str)
{
if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'windows-1251', 'utf-8');
if (function_exists('iconv')) return iconv('utf-8', 'windows-1251', $str);
$utf8win1251 = array(
"А"=>"xC0","Б"=>"xC1","В"=>"xC2","Г"=>"xC3","Д"=>"xC4","Е"=>"xC5","Ё"=>"xA8","Ж"=>"xC6","З"=>"xC7","И"=>"xC8","Й"=>"xC9","К"=>"xCA","Л"=>"xCB","М"=>"xCC",
"Н"=>"xCD","О"=>"xCE","П"=>"xCF","Р"=>"xD0","С"=>"xD1","Т"=>"xD2","У"=>"xD3","Ф"=>"xD4","Х"=>"xD5","Ц"=>"xD6","Ч"=>"xD7","Ш"=>"xD8","Щ"=>"xD9","Ъ"=>"xDA",
"Ы"=>"xDB","Ь"=>"xDC","Э"=>"xDD","Ю"=>"xDE","Я"=>"xDF","а"=>"xE0","б"=>"xE1","в"=>"xE2","г"=>"xE3","д"=>"xE4","е"=>"xE5","ё"=>"xB8","ж"=>"xE6","з"=>"xE7",
"и"=>"xE8","й"=>"xE9","к"=>"xEA","л"=>"xEB","м"=>"xEC","н"=>"xED","о"=>"xEE","п"=>"xEF","р"=>"xF0","с"=>"xF1","т"=>"xF2","у"=>"xF3","ф"=>"xF4","х"=>"xF5",
"ц"=>"xF6","ч"=>"xF7","ш"=>"xF8","щ"=>"xF9","ъ"=>"xFA","ы"=>"xFB","ь"=>"xFC","э"=>"xFD","ю"=>"xFE","я"=>"xFF");
return strtr($str, $utf8win1251);
}
function win_to_utf($str)
{
if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'utf-8', 'windows-1251');
if (function_exists('iconv')) return iconv('windows-1251', 'utf-8', $str);
$win1251utf8 = array(
"xC0"=>"А","xC1"=>"Б","xC2"=>"В","xC3"=>"Г","xC4"=>"Д","xC5"=>"Е","xA8"=>"Ё","xC6"=>"Ж","xC7"=>"З","xC8"=>"И","xC9"=>"Й","xCA"=>"К","xCB"=>"Л","xCC"=>"М",
"xCD"=>"Н","xCE"=>"О","xCF"=>"П","xD0"=>"Р","xD1"=>"С","xD2"=>"Т","xD3"=>"У","xD4"=>"Ф","xD5"=>"Х","xD6"=>"Ц","xD7"=>"Ч","xD8"=>"Ш","xD9"=>"Щ","xDA"=>"Ъ",
"xDB"=>"Ы","xDC"=>"Ь","xDD"=>"Э","xDE"=>"Ю","xDF"=>"Я","xE0"=>"а","xE1"=>"б","xE2"=>"в","xE3"=>"г","xE4"=>"д","xE5"=>"е","xB8"=>"ё","xE6"=>"ж","xE7"=>"з",
"xE8"=>"и","xE9"=>"й","xEA"=>"к","xEB"=>"л","xEC"=>"м","xED"=>"н","xEE"=>"о","xEF"=>"п","xF0"=>"р","xF1"=>"с","xF2"=>"т","xF3"=>"у","xF4"=>"ф","xF5"=>"х",
"xF6"=>"ц","xF7"=>"ч","xF8"=>"ш","xF9"=>"щ","xFA"=>"ъ","xFB"=>"ы","xFC"=>"ь","xFD"=>"э","xFE"=>"ю","xFF"=>"я");
return strtr($str, $win1251utf8);
}
function is_utf($str)
{
$c = 0;
$b = 0;
$bits = 0;
$len = strlen($str);
for($i = 0; $i < $len; $i++)
{
$c = ord($str[$i]);
if ($c > 128) {
if (($c >= 254)) return false;
elseif ($c >= 252) $bits = 6;
elseif ($c >= 248) $bits = 5;
elseif ($c >= 240) $bits = 4;
elseif ($c >= 224) $bits = 3;
elseif ($c >= 192) $bits = 2;
else return false;
if (($i + $bits) > $len) return false;
while ($bits > 1) {
$i++;
$b = ord($str[$i]);
if ($b < 128 || $b > 191) return false;
$bits--;
}
}
}
return true;
}
function level_name($level, $us)
{
if($level == 0 || $us == 1) echo 'Пользователь';
elseif($level == 0 || $us == 2) echo 'Пользователь';
elseif($level == 0 || $us == 24) echo 'Пользователь';
elseif($level == 1) echo 'Модератор';
elseif($level == 2) echo 'Ст. Модератор';
elseif($level == 3) echo 'Администратор';
elseif($level == 4) echo 'Руководство';
}
function head_panel($title)
{
$user['id'] = $_SESSION['user_id'];
if($user['id'])
{
$new_privat = mysql_result(mysql_query('select count(*) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($new_privat) $new_privat = '<font color="#000"> <b> (+'.$new_privat.')</font></b>'; else $new_privat = '';
$new_op = mysql_result(mysql_query('select count(*) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($new_op) $new_op = '<font color="#000"><b> (+'.$new_op.')</font></b>'; else $new_op = '';
echo '
<a href="/"><div class="logo">
<img src="/images/cornerhat.png" class="snoww">
<span style="font-family: drunkC; font-size:22px;">
'.$title.'
</span>
</div>
</a>
<div class="start">
<div class="s" style="border-bottom:none;">
<table style="width:100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="vertical-align:top;width:10%;">
<center>
<a href="/cab" title="Кабинет">
<img class="ico" align="middle" src="/images/vcard.png" alt="*">
</a>
</center>
</td>
<td style="vertical-align:top;width:10%;">
<center>
<a href="/privat/" title="Почта">
<img class="ico" align="middle" src="/images/mail2.png" alt="*">
'.$new_privat.'
</a>
</center>
</td>
<td style="vertical-align:top;width:10%;">
<center>
<a href="/op/" title="Оповещения">
<img class="ico" align="middle" src="/images/warning.png" alt="*">
'.$new_op.'
</a>
</center>
</td>
</tr>
</tbody>
</table>
</div>';
}
else
{
header('Location: /?'); exit;
}
}
function TextGuard($text)
{
return mysql_real_escape_string(htmlspecialchars(trim($text)));
}
function links_preg1($arr){
if(ereg('^http://'.$_SERVER['HTTP_HOST'],$arr[1])){
return '<a href="'.$arr[1].'">'.$arr[2].'</a>';
} else {
return '<a href="'.$arr[1].'">'.$arr[2].'</a>';
}
}
function links_preg2($arr){
if(ereg('^http://'.$_SERVER['HTTP_HOST'],$arr[2])){
return $arr[1].'<a href="'.$arr[2].'">'.$arr[2].'</a>'.$arr[4];
} else {
return $arr[1].'<a href="'.$arr[2].'">'.$arr[2].'</a>'.$arr[4];
}
}
function links($msg){
$msg=preg_replace_callback('~[url=([a-z]+://[^ rnt`'"]+)](.*?)[/url]~iu', 'links_preg1', $msg);
$msg=preg_replace_callback('~(^|s)([a-z]+://([^ rnt`'"]+))(s|$)~iu', 'links_preg2', $msg);
return $msg;
}
function out($var){
$text = nl2br(smiles(bbcode(links($var))));
return $text;
}
function gradient($text,$from='', $to='', $mode="hex"){
$text = iconv("UTF-8", "windows-1251", $text);
if($mode=="hex")
{
$to = hexdec($to[0].$to[1]).",".hexdec($to[2].$to[3]).",".hexdec($to[4].$to[5]);
$from = hexdec($from[0].$from[1]).",".hexdec($from[2].$from[3]).",".hexdec($from[4].$from[5]);
}
if(empty($text))
return '';
else
$levels=strlen($text);
if(empty($from))
$from = array(0,0,255);
else
$from = explode(",", $from);
if (empty($to))
$to = array(255,0,0);
else
$to = explode(",", $to);
$output = "";
for ($i=1;$i<=$levels;$i++)
{
for ($ii=0;$ii<4;$ii++)
{
$tmp[$ii] = $from[$ii] - $to[$ii];
$tmp[$ii] = floor($tmp[$ii] / $levels);
$rgb[$ii] = $from[$ii] -($tmp[$ii] * $i);
if($rgb[$ii] > 255) $rgb[$ii] = 255;
$rgb[$ii] = dechex($rgb[$ii]);
$rgb[$ii] = strtoupper($rgb[$ii]);
if(strlen($rgb[$ii]) < 2) $rgb[$ii] = "0$rgb[$ii]";
}
$output .= "<font color="#".$rgb[0].$rgb[1].$rgb[2]."">" . $text[$i -1 ] . "</font>";
}
return iconv("windows-1251", "UTF-8", $output);
}
function ustatus($id){
$users = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$id.'" limit 1'));
if($users['sex'] == 1){
if($users['online'] > time()-3600) return '<img src="/modules/bl/files/'.$users['icon'].'.png" alt="*" width="16" height="16"/>';
else return '<img src="/modules/bl/files/mof.png"/>';
}elseif($users['sex'] == 2){
if($users['online'] > time()-3600) return '<img src="/modules/bl/files/'.$users['icon1'].'.png" alt="*" width="16" height="16"/>';
else return '<img src="/modules/bl/files/jof.png"/>';
}}
function uname($id){
$users = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$id.'" limit 1'));
if($users != 0){
$nicks = mysql_query("SELECT * FROM `nicks` where `who` = '".$users['id']."' ORDER BY `id` DESC LIMIT 1");
while($nicks2 = mysql_fetch_assoc($nicks)){
$users['login'] = $nicks2['new'];
}
$gradient = mysql_fetch_array(mysql_query('select * from `gradient` where `who` = "'.$id.'" limit 1'));
if($gradient != 0 && $gradient['start'] != NULL && $gradient['end'] != NULL) return '<b>'.gradient($users['login'],$gradient['start'],$gradient['end']).'</b>'; else return '<b>'.$users['login'].'</b>';
}else{
return '[Удален]';
}
}
function uaccess($id){
$users = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$id.'" limit 1'));
if($users != 0 && $id != 1 && $id != 2 && $id != 24)
{
if($users['status'] >= 1)
{
if($users['status'] == 1) $access = 'мд';
elseif($users['status'] == 2) $access = 'ст.мод';
elseif($users['status'] == 3) $access = 'адм';
elseif($users['status'] == 4) $access = 'рук';
return '<font color="green">['.$access.']</font>';
}
}
}
function user($id)
{
$us = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$id.'" limit 1'));
if($us == 0)
{
return '[Удалён]';
}
else
{
$nicks = mysql_query("SELECT * FROM `nicks` where `who` = '".$us['id']."' ORDER BY `id` DESC LIMIT 1");
while($nicks2 = mysql_fetch_assoc($nicks)){
$us['login'] = $nicks2['new'];
}
$gradient = mysql_fetch_array(mysql_query('select * from `gradient` where `who` = "'.$id.'" limit 1'));
if($gradient != 0 && $gradient['start'] != NULL && $gradient['end'] != NULL) $us_login = '<b>'.gradient($us['login'],$gradient['start'],$gradient['end']).'</b>'; else $us_login = $us['login'];
switch($us['status'])
{
case '1': $us_access = 'мд';
break;
case '2': $us_access = 'адм';
break;
case '3': $us_access = 'ст.адм';
break;
case '4':
if($id == 1 && $id == 2) $us_access = '';
else $us_access = 'соз';
break;
}
if($us['status'] >= 1) $us_access2 = ' <font color="green">['.$us_access.']</font>';
return '<img src="/modules/profile/images/'.($us['sex'] == 1 ? 'm' : 'j').($us['online'] > (time()-300) ? 'on' : 'of').'.png" alt="*"/> <a href="/us'.$us['id'].'"><b>'.$us_login.'</b></a> '.$us_access2;
echo ''.$us_prepis2.'';
}
}
function slv($str,$msg1,$msg2,$msg3) {
$str = (int)$str;
$str1 = abs($str) % 100;
$str2 = $str % 10;
if ($str1 > 10 && $str1 < 20) return $str .' '. $msg3;
if ($str2 > 1 && $str2 < 5) return $str .' '. $msg2;
if ($str2 == 1) return $str .' '. $msg1;
return $str .' '. $msg3;
}
function times($times=NULL){
$time = time();
if(($time-$times)<=60){
$timesp = slv((($time-$times)),'секунду','секунды','секунд').' назад';
return $timesp;
} else if(($time-$times)<=3600){$timesp = slv((($time-$times)/60),'минуту','минуты','минут').' назад';
return $timesp;
} else {
$today = date("j M Y", $time);
$today = date("j M Y", $time);
$yesterday = date("j M Y", strtotime("-1 day"));
$timesp=date("j M Y в H:i", $times);
$timesp = str_replace($today, 'Сегодня', $timesp);
$timesp = str_replace($yesterday, 'Вчера', $timesp);
$timesp = strtr($timesp, array ("Jan" => "Янв","Feb" => "Фев","Mar" => "Марта","May" => "Мая","Apr" => "Апр","Jun" => "Июня","Jul" => "Июля","Aug" => "Авг","Sep" => "Сент","Oct" => "Окт","Nov" => "Ноября","Dec" => "Дек",));
return $timesp;}
}
function times2($string) {
$day=floor($string/86400);
$hours=floor(($string/3600)-$day*24);
$min=floor(($string-$hours*3600-$day*86400)/60);
$sec=$string-($min*60+$hours*3600+$day*86400);
if($day > 0) $day2 = $day.' дней';
if($hours > 0 ) $hours2 = $hours.' часов';
if($min > 0 ) $min2 = $min.' минут';
if($sec > 0 ) $sec2 = $sec.' секунд';
return $day2.' '.$hours2.' '.$min2.' '.$sec2;
}
function antispam($text){
$text = trim($text);
$anti = mysql_query("SELECT * FROM `antispam` ");
while($spam = mysql_fetch_array($anti)){
$text = str_replace($spam['site'],''.$spam['zamena'].'',$text);
}
return $text;
}
function bbcode($mes){
$mes=stripslashes($mes);
$array = array('#[img](.+?)[/img]#is');
$replace = array('<a href="$1"><img src="$1" width="50" height="50" alt="*"></a>');
/*$mes = preg_replace("#(?:http://)?(.*?)(.gif|.png|.jpeg|.jpg)#",'<img src="http://12" alt="Изображение"/>', $mes);*/
//$mes = preg_replace('~http://([^ rnt`'"]+)(s|$)~iu', '<a href="http://1"><img src="http://www.iconsearch.ru/uploads/icons/realistik-new/16x16/package_network.png" alt="Ссылка"/> Ссылка</a> ', $mes);
$mes = preg_replace('#[b](.*?)[/b]#si', '<b>1</b>', $mes);
$mes = preg_replace('#[img](.*?)[/img]#si', '<a href="1" title="Нажмите для масштабирования"><img src="1" width="50" height="50" alt="Картинка"></a>', $mes);
$mes = preg_replace('#[i](.*?)[/i]#si', '<i>1</i>', $mes);
$mes = preg_replace('#[red](.*?)[/red]#si', '<span style="color:#FF0000;">1</span>', $mes);
$mes = preg_replace('#[blue](.*?)[/blue]#si', '<span style="color:#00008b;">1</span>', $mes);
$mes = preg_replace('#[white](.*?)[/white]#si', '<span style="color:#ffffff;">1</span>', $mes);
$mes = preg_replace('#[green](.*?)[/green]#si', '<span style="color:#006400;">1</span>', $mes);
$mes = preg_replace('#[u](.*?)[/u]#si', '<u>1</u>', $mes);
$mes = preg_replace('#[cit](.*?)[/cit]#si', '<div class="cit">1</div>', $mes);
$mes = preg_replace('#[url=(.*?)](.*?)[/url]#si', '<a href="1">2</a>', $mes);
$mes=str_replace("rn","<br/>",$mes);
$mes=str_replace("[br]","<br/>",$mes);
$mes = preg_replace('#[code](.*?)[/code]#si', '<div class="cit"><code>1</code></div>', $mes);
return $mes;
}
function smiles($text){
$text = trim($text);
$smiles = mysql_query("SELECT * FROM `smiles` ORDER BY `id` DESC");
while($smiles2 = mysql_fetch_array($smiles)){
$text = str_replace($smiles2['name'],' <img src="/smiles/'.$smiles2['img'].'" alt="'.$smiles2['name'].'"/> ',$text);
}
return $text;
}
?>