<?php
function smile($text){
$arr=array(':)', '=)', ':-)', ')))', '))');
$arr2=array(':D', ':Д', ':-D', ':-d', ':-Д');
$arr3=array(':yahoo', ':яхуу');
$arr4=array(':rip', ':гроб');
$arr5=array(':plaksa', ':плакса');
$arr6=array(':haha', ':хаха');
$arr7=array(':kur', ':кур');
$arr8=array(':lol', ':лол');
$arr9=array(':lol2', ':лол2');
$arr10=array(':glaza', ':глаза');
$arr11=array(':fu', ':фу');
$arr12=array(':druzhba', ':дружба');
$arr13=array(':mail', ':почта');
$arr14=array(':poka', ':пока');
$arr15=array(':(', '=(', '((');
$arr16=array(':super', ':супер');
$arr17=array(':umora', ':умора');
$arr18=array(':vantuz', ':вантуз');
$arr19=array(':хм', ':неверю', ':hm', ':\\');
$arr20=array(':vopros', ':вопрос');
$arr21=array(':dovolen', ':доволен');
$arr22=array(':dash', ':стена');
$arr23=array(':афигеть', ':afiget');
$arr24=array(':аларм', ':alarm');
$arr25=array(':podmig', ':подмиг');
$arr26=array(';)', ';-)');
$qwe=str_ireplace($arr, '<img src=\'smile/smile.gif\'>', $text);
$qwe=str_ireplace($arr2, '<img src=\'smile/xd.gif\'>', $qwe);
$qwe=str_ireplace($arr3, '<img src=\'smile/yahoo.gif\'>', $qwe);
$qwe=str_ireplace($arr4, '<img src=\'smile/rip.gif\'>', $qwe);
$qwe=str_ireplace($arr5, '<img src=\'smile/plaksa.gif\'>', $qwe);
$qwe=str_ireplace($arr6, '<img src=\'smile/haha.gif\'>', $qwe);
$qwe=str_ireplace($arr7, '<img src=\'smile/kur.gif\'>', $qwe);
$qwe=str_ireplace($arr8, '<img src=\'smile/lol.gif\'>', $qwe);
$qwe=str_ireplace($arr9, '<img src=\'smile/lol2.gif\'>', $qwe);
$qwe=str_ireplace($arr10, '<img src=\'smile/glaza.gif\'>', $qwe);
$qwe=str_ireplace($arr11, '<img src=\'smile/fu.gif\'>', $qwe);
$qwe=str_ireplace($arr12, '<img src=\'smile/druzhba.gif\'>', $qwe);
$qwe=str_ireplace($arr13, '<img src=\'smile/mail.gif\'>', $qwe);
$qwe=str_ireplace($arr14, '<img src=\'smile/poka.gif\'>', $qwe);
$qwe=str_ireplace($arr15, '<img src=\'smile/sad.gif\'>', $qwe);
$qwe=str_ireplace($arr16, '<img src=\'smile/super.gif\'>', $qwe);
$qwe=str_ireplace($arr17, '<img src=\'smile/umora.gif\'>', $qwe);
$qwe=str_ireplace($arr18, '<img src=\'smile/vantuz.gif\'>', $qwe);
$qwe=str_ireplace($arr19, '<img src=\'smile/xm.gif\'>', $qwe);
$qwe=str_ireplace($arr20, '<img src=\'smile/vopros.gif\'>', $qwe);
$qwe=str_ireplace($arr21, '<img src=\'smile/dovolen.gif\'>', $qwe);
$qwe=str_ireplace($arr22, '<img src=\'smile/dash.gif\'>', $qwe);
$qwe=str_ireplace($arr23, '<img src=\'smile/afiget.gif\'>', $qwe);
$qwe=str_ireplace($arr24, '<img src=\'smile/alarm.gif\'>', $qwe);
$qwe=str_ireplace($arr25, '<img src=\'smile/wink.gif\'>', $qwe);
$qwe=str_ireplace($arr26, '<img src=\'smile/blink.gif\'>', $qwe);
return $qwe;
}
function pages($q, $w, $e){
if ($q==2)echo "<div class='input'><a href='$e=1'>1</a> <a href='$e=2'>2</a></div>";
if ($q==3)echo "<div class='input'><a href='$e=1'>1</a> <a href='$e=2'>2</a> <a href='$e=3'>3</a></div>";
if (($q>3) && ($w!=1) && ($w!=$q))echo "<div class='input'><a href='$e=1'>[1]</a> <a href='$e=".($w-1)."'>[".($w-1)."]</a> .. <a href='$e=".($w+1)."'>[".($w+1)."]</a> <a href='$e=$q'>[$q]</a><br><form method='GET' action='$e'><input type='text' size='2' name='p' value='$w'> <input type='submit' value='Ок'></form></div>";
elseif (($q>3) && ($w!=1) && ($w==$q))echo "<div class='input'><a href='$e=1'>[1]</a> <a href='$e=".($w-1)."'>[".($w-1)."]</a><br><form method='GET' action='$e'><input type='text' size='2' name='p' value='$w'> <input type='submit' value='Ок'></form></div>";
elseif (($q>3) && ($w==1) && ($w!=$q))echo "<div class='input'><a href='$e=".($w+1)."'>[".($w+1)."]</a> <a href='$e=$q'>[$q]</a><br><form method='GET' action='$e'><input type='text' size='2' name='p' value='$w'> <input type='submit' value='Ок'></form></div>";
}
function div($in){
echo "<div class='$in'>";
return true;
}
function nodiv(){
echo "</div>";
return true;
}
function msg($txt){
echo "<div class='msg'>$txt</div>";
return true;
}
function copyright(){
//за изменение данного кода последует жлоба хостеру, затем блокировка сайта
echo "<b>© <a href='http://vQCMS.ru'>QCMS</a></b>";
return true;
//за изменение данного кода последует жлоба хостеру, затем блокировка сайта
}
function vremja($time=NULL)
{
global $user;
if ($time==NULL)$time=time();
$timep="".date("j M Y в H:i", $time)."";
$time_p[0]=date("j n Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if (isset($user)){
if ($time_p[0]==date("j n Y", time()))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*(24)))$timep="Вчера в $time_p[1]";}
else{
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*24))$timep="Вчера в $time_p[1]";}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
if (isset($_COOKIE['name']) && isset($_COOKIE['pass'])){
$name=mysql_escape_string($_COOKIE['name']);
$pass=mysql_escape_string($_COOKIE['pass']);
$ma=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `name` = '$name'"));
if ($ma['pass']==$pass){
$user=$ma;
}}
function on($in){
$i=intval($in);
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$i'"));
if (($ank['famous']>1) && ($ank['famous']<2))$ret='<img src="/icon/m1.png">';
if (($ank['famous']>2) && ($ank['famous']<4))$ret='<img src="/icon/m2.png">';
if ($ank['famous']>4)$ret='<img src="/icon/m3.png">';
//if ($ank['moder']==1)$ret.=" <font color='blue'><b>[+]</b></font>";
return $ret;
}
function gus($in){
if ($in==0){
$ank2['name']='Информатор';
$ank2['click']=time();
$ank2['famous']=100500;
$ank2['pol']=0;
return $ank2;
}
else
return mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$in'"));
}
function rekl($in){
$ret='</div><div class="rekl">';
$q=mysql_query("SELECT * FROM `rekl` WHERE `where` = '$in' AND `time` > '".time()."'");
while ($f=mysql_fetch_assoc($q)){
if (mysql_num_rows($q)!=1)$ret.="<br>";
if ($f['img'])$ret.="<a href='".htmlspecialchars($f['href'])."'><img src='".htmlspecialchars($f['img'])."' alt='".htmlspecialchars($f['name'])."'></a>";
else $ret.="<a href='".htmlspecialchars($f['href'])."'>".htmlspecialchars($f['name'])."</a>";
}
$ret.="</div>";
if (mysql_num_rows($q)==0)$ret='';
return $ret;
}
function im($in)
{
global $set,$time;
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$in' AND `click` > '".(time()-600)."' LIMIT 1"),0)==1)
{$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$in' LIMIT 1"));
if ($ank['pol']==1)
{ $onchel='<img src="/icon/man_on.png" width="14">';}else{$onchel='<img src="/icon/girl_on.png" width="14">';}
if (($ank['moder']==1) && ($ank['pol']==1))$onchel='<img src="/icon/moder_on.png" width="14">';
if (($ank['moder']==1) && ($ank['pol']==0))$onchel='<img src="/icon/girl_moder_on.png" width="14">';
if (($ank['admin']==1) && ($ank['pol']==1))$onchel='<img src="/icon/admin_on.png" width="14">';
if (($ank['admin']==1) && ($ank['pol']==0))$onchel='<img src="/icon/girl_admin_on.png" width="14">';
} else {$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$in' LIMIT 1"));
if ($ank['pol']==1)
{$onchel='<img src="/icon/man_off.png" width="14">';}else{
$onchel='<img src="/icon/girl_off.png" width="14">';}
if (($ank['moder']==1) && ($ank['pol']==1))$onchel='<img src="/icon/moder_off.png" width="14">';
if (($ank['moder']==1) && ($ank['pol']==0))$onchel='<img src="/icon/girl_moder_off.png" width="14">';
if (($ank['admin']==1) && ($ank['pol']==1))$onchel='<img src="/icon/admin_on.png" width="14">';
if (($ank['admin']==1) && ($ank['pol']==0))$onchel='<img src="/icon/girl_admin_on.png" width="14">';
}
return $onchel;
}
function bbcode($in){
$in=preg_replace("/\[url=(.+)\](.+)\[\/url\]/isU", "<a href='$1'>$2</a>", $in);
$in=preg_replace("/\[b\](.+)\[\/b\]/isU", "<b>$1</b>", $in);
$in=preg_replace("/\[u\](.+)\[\/u\]/isU", "<u>$1</u>", $in);
$in=preg_replace("/\[s\](.+)\[\/s\]/isU", "<s>$1</s>", $in);
$in=preg_replace("/\[color=(.+)\](.+)\[\/color\]/isU", "<font color='$1'>$2</font>", $in);
return $in;
}
function out($in){
return nl2br(smile(bbcode(htmlspecialchars($in))));
}
if (!$user){
$ip=out($_SERVER['REMOTE_ADDR']);
$browser=out($_SERVER['HTTP_USER_AGENT']);
$q=mysql_query("SELECT * FROM `guests` WHERE `ip` = '$ip' AND `tel` = '$browser'");
if (mysql_num_rows($q)==0){
mysql_query("INSERT INTO `guests` (`ip`, `tel`, `click`, `time`) values ('$ip', '$browser', '1', '".time()."')");
}
else
{
$now=mysql_fetch_array($q);
$click=($now['click']+1);
mysql_query("UPDATE `guests` SET `click` = '$click' WHERE `ip` = '$ip' AND `tel` = '$browser'");
mysql_query("UPDATE `guests` SET `time` = '".time()."' WHERE `ip` = '$ip' AND `tel` = '$browser'");
}
}
mysql_query("DELETE FROM `guests` WHERE `time` < '".(time()-86400)."'");
if ((mysql_num_rows(mysql_query("SELECT * FROM `ban` WHERE `user` = '$user[id]' AND `time` > '".time()."'"))>0) && ($_SERVER['PHP_SELF']!='/ban.php')){
header("Location: /ban.php");
die("АКТИВНЫЙ БАН!");
}
?>