Размер файла: 4.21Kb
<?php
error_reporting(0);
$urls='index.php';
$ttl='';
include("config.php");
include("./includes/constants/menu");
include("./includes/html/banned");
$old_msgs = 6; //HOURS
$fd = fopen("clear.dat", "r");
$clear_time = intval(fgets($fd));
fclose($fd);
if($clear_time < time())
{
$sql = mysql_query("SELECT `id` FROM `chat_rooms`;");
while($room = mysql_fetch_array($sql))
{
mysql_query("DELETE FROM `chat".$room['id']."` WHERE `seconds` < ".(time() - (3600 * $old_msgs)).";");
mysql_query("DELETE FROM `chat_intim` WHERE `seconds` < ".(time() - (3600 * $old_msgs)).";");
}
$fd = fopen("clear.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, (time() + 3600 * $old_msgs));
flock($fd, LOCK_UN);
fclose($fd);
}
list($msec, $sec) = explode(chr(32), microtime());
$headtime = $sec + $msec;
$ref = rand(10000, 99999);
include("./template/all.php");
header ("Content-type: text/html; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
include("./template/head.php");
///
//STATUS UPDATE
if($status == STATUS_NOVICE && $posts > 500 && $posts < 1000)
{
$query = mysql_query("UPDATE `chat_users` SET `status` = '".STATUS_USER."' WHERE `id` = '".$id."';");
}
if($status == STATUS_USER && $posts > 1000 && $posts < 3000)
{
$query = mysql_query("UPDATE `chat_users` SET `status` = '".STATUS_ADVANCED."' WHERE `id` = '".$id."';");
}
if($status == STATUS_ADVANCED && $posts > 3000 && $posts < 5000)
{
$query = mysql_query("UPDATE `chat_users` SET `status` = '".STATUS_CHATTER."' WHERE `id` = '".$id."';");
}
if($status == STATUS_CHATTER && $posts > 5000 && $posts < 7000)
{
$query = mysql_query("UPDATE `chat_users` SET `status` = '".STATUS_SUPER."' WHERE `id` = '".$id."';");
}
if($status == STATUS_SUPER && $posts > 7000 && $posts < 10000)
{
$query = mysql_query("UPDATE `chat_users` SET `status` = '".STATUS_MEGA."' WHERE `id` = '".$id."';");
}
//END STATUS UPDATE
if($level == 4) echo "<a href=\"admin.php\">Админка</a><br/>\n";
if($level == 3) echo "<a href=\"smoder.php\">С-модерка</a><br/>\n\n";
if($level == 2) echo "<a href=\"moder.php\">Модерка</a><br/\n\n";
if($level == 1) echo "<a href=\"vip.php\">VIP-меню</a><br/>\n";
///
//NEWS
//$query = mysql_query("SELECT `id`, `name` FROM `chat_news` ORDER BY `id` DESC;");
//while($news = @mysql_fetch_array($query))
//{
//$nid = $news['id'];
//$name = $news['name'];
//echo "<a href=\"news.php?id=$id&password=$password&nid=$nid&ver=html\">".$name."</a><br/>\n";
//}
//END NEWS
//PUBLIC ROOMS
$q = mysql_query("SELECT * FROM `chat_rooms` WHERE `type` = 0 ORDER BY `position` ASC;");
if(mysql_num_rows($q) == 0)
{
echo EMPTY_ROOMS_LIST."<br/>\n";
}
echo 'Комнаты:<br/>';
while($room = mysql_fetch_array($q))
{
$rid = $room['id'];
$rname = $room['name'];
$query = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `place` = ".$rid." AND `time` >= ".time().";");
$inroom = mysql_result($query, 0);
if($rid == $wicked_quiz or $rid == $unlim)
{
echo "» <a href=\"unlim.php?rid=$rid\">".$rname."</a>(".$inroom.")<br/>\n";
}
else
{
echo "» <a href=\"room.php?rid=$rid\">".$rname."</a>(".$inroom.")<br/>\n";
}
}
//END ROOMS
//ROOMS FOR MODERATORS
if($level != 0)
{
echo 'Модерские:<br/>';
$q = mysql_query("SELECT * FROM `chat_rooms` WHERE `type` = 1 ORDER BY `position` ASC;");
while($room = mysql_fetch_array($q))
{
$rid = $room['id'];
$rname = $room['name'];
$query = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `place` = ".$rid." AND `time` >= ".time().";");
$inroom = mysql_result($query, 0);
echo "» <a href=\"room.php?rid=$rid\">".$rname."</a>(".$inroom.")<br/>\n";
}
if(mysql_num_rows($q) != 0)
{
echo "\n";
}
}
//END ROOMS
echo 'Информация:<br/>';
echo "» <a href=\"rules.php\">Правила чата</a><br/>\n";
echo "» <a href=\"profile.php\">".MENU_PROFILE."</a><br/>\n";
echo "» <a href=\"settings.php\">".MENU_SETTINGS."</a><br/>\n";
echo "» <a href=\"faq.php?mod=smiles\">Таблица смайликов</a><br/>\n";
echo "» <a href=\"faq.php?mod=translit\">Правила translita</a><br/>\n";
echo "» <a href=\"faq.php?mod=govenment\">Список модераторов</a><br/>\n";
include("./template/foot.php");
?>