<?

header("Cache-Control: no-cache");
header("Content-Type:text/html; charset=UTF-8");

require("inc.php");
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);      
require("version.php");

if($rm==10) $takep="&amp;pwd=$pwd&amp;ref=$ref";
else if($mod=="privat") $takep="&amp;mod=$mod&amp;ref=$ref";
else $takep="&amp;ref=$ref";

$r = mysql_query ("select count(readd) as num from zapiski WHERE (idtowhom = '".$id."')and(readd = '0')and(ininc = '1')");
$a = mysql_fetch_array($r);
$inb = $a["num"]; 

echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";
echo "<title>Функции</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
echo $fsize1;

if ($row["kn_update"]==0) echo "<a href=\"chat.php?$ses&amp;rm=$rm$takep\">Обновить</a><br/>";  
if ($row["kn_say"]==0) echo "<a href=\"add.php?$ses&amp;rm=$rm$takep\">Сказать</a><br/>";
if ($rm==23){
echo "<a href=\"mafrules.php?$ses&amp;rm=$rm&amp;mod=1&amp;ref=$ref\">Правила игры</a><br/>\n";
echo "<a href=\"statistik.php?$ses&amp;rm=$rm&amp;mod=10maf&amp;ref=$ref\">TOP 10</a><br/>";
echo "<a href=\"help.php?$ses&amp;rm=$rm&amp;ref=$ref\">Помощь</a><br/>";
}
if (($row["kn_privat"]==0)&&($rm!=10)){
if ($mod=="privat") echo "<a href=\"chat.php?$ses&amp;rm=$rm&amp;ref=$ref\">Фильтр[P!]-выкл</a><br/>"; 
else echo "<a href=\"chat.php?$ses&amp;rm=$rm&amp;mod=privat$takep\">Фильтр[P!]-вкл</a><br/>"; 
}
if ($row["kn_letters"]==0) echo "<a href=\"chatmail.php?$ses&amp;rm=$rm$takep\">Записки(".$inb.")</a><br/>"; 
if ($row["kn_whochat"]==0) echo "<a href=\"who.php?$ses&amp;rm=$rm$takep\">Кто где?</a><br/>"; 
$room = "room".$rm;
$tm = time()-300;
$r = @mysql_query ("Select who from $room WHERE id > '".$tm."' group by who order by id desc;");
$asnum = mysql_affected_rows();
if (($row["kn_whoroom"]==0)&&($rm!=10)) echo "<a href=\"whoroom.php?$ses&amp;rm=$rm$takep\">Кто тут?(".($asnum).")</a><br/>";  
if (($row["kn_clroom"]==0)&&($row["level"]>=7)){
echo "<a href=\"apanel.php?$ses&amp;go=clroom&amp;rm=$rm$takep\">Чистка Всех комнат</a><br/>";  
echo "<a href=\"apanel.php?$ses&amp;go=clrm&amp;rm=$rm$takep\">Чистка комнаты</a><br/>";
}
if ($row["kn_nood"]==0) echo "<a href=\"nood.php?$ses&amp;mod=select&amp;rm=$rm$takep\">Настроение</a><br/>";  
if ($row["kn_cabinet"]==0) echo "<a href=\"cabinet.php?$ses&amp;rm=$rm$takep\">Личное</a><br/>"; 
if (($row["kn_stats"]==0)&&($rm==0)) echo "<a href=\"statistik.php?$ses&amp;rm=$rm&amp;mod=10ym&amp;ref=$ref\">Статистика</a><br/>"; 
if (($row["kn_kommands"]==0)&&($rm==0)) echo "<a href=\"faq.php?$ses&amp;rm=$rm&amp;ref=$ref&amp;mod=vict_kom\">Команды</a><br/>"; 
if (($row["trade"]==0)&&($rm==0)) echo "<a href=\"prodavec.php?$ses&amp;rm=$rm&amp;ref=$ref\">Купи ответ</a><br/>";  
if (($row["kn_sos"]==0)&&($rm!=9)&&($rm!=10)&&($row["level"]<4)) echo "<a href=\"sos.php?$ses&amp;rm=$rm$takep\">Вызов Модера</a><br/>"; 
if ($rm==10) echo "<a href=\"intim.php?$ses&amp;rm=$rm&amp;ref=$ref\">Сменить ключ</a><br/>";  
if (($row["level"]>5)&&($rm!=10)&&($row["kn_topic"]==0)) echo "<a href=\"topic.php?$ses&amp;rm=$rm$takep\">Топик</a><br/>"; 
if (($rm==9)||($rm==11)) echo "<a href=\"./genmat/index.php?$ses&amp;rm=$rm&amp;ref=$ref\">Генератор мата</a><br/>"; 
echo "<hr/>";
if ($rm==23) echo "<a href=\"chat.php?$ses&amp;rm=$rm$takep\">&#8592; В игру</a><br/>";
else echo "<a href=\"chat.php?$ses&amp;rm=$rm$takep\">&#8592; В чат</a><br/>";
$fsize2;
echo "</div></body></html>"; 
mysql_close ($link);
?>