<?php
#==============================================================================================#
# Name : Imperial CHAT #
# Made by : MaZaFaKa (___хакер___) #
# MODED : vipsds ( BOT ) #
# ICQ : 350502220 (vipsds) #
# E-mai : [email protected] #
# По всем вопросам и дополнительным модам обращайтесь на выше указанные данные #
#==============================================================================================#
error_reporting(0);
include 'start.php';
include 'config.php';
include 'includes/constants/menu';
include 'includes/'.$ver.'/banned';
$ttl = 'Добро пожаловать!';
$old_msgs = 6; //HOURS
$fd = fopen('system/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_assoc($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('system/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 = mt_rand(10000, 99999);
$banner = file('system/banner.dat');
$ssylka = trim($banner[0]);
$img = trim($banner[1]);
switch($ver)
{
////////////////////////////////////////////////////////
//WML VERSION
////////////////////////////////////////////////////////
case 'wml':
header("Content-type: text/vnd.wap.wml; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");
//AUTH
if(isset($_POST['action']) or ($_GET['action']))
{
if($_POST['translit'] == "true")
{
$lat = array("''", "'", "\"\"", "\"", "CH", "ch", "SC", "sc", "YE", "ye", "YU", "yu", "YA", "ya", "YO", "yo", "A", "a", "B", "b", "C", "c", "D", "d", "E", "e", "F", "f", "G", "g", "H", "h", "I", "i", "J", "j", "K", "k", "L", "l", "M", "m", "N", "n", "O", "o", "P", "p", "R", "r", "S", "s", "T", "t", "U", "u", "V", "v", "H", "h", "Z", "z", "W", "w", "X", "x", "Y", "y");
$rus = array("Ь", "ь", "Ъ", "ъ", "Ч", "ч", "Щ", "щ", "Э", "э", "Ю", "ю", "Я", "я", "Ё", "ё", "А", "а", "Б", "б", "Ц", "ц", "Д", "д", "Е", "е", "Ф", "ф", "Г", "г", "Х", "х", "И", "и", "Ж", "ж", "К", "к", "Л", "л", "М", "м", "Н", "н", "О", "о", "П", "п", "Р", "р", "С", "с", "Т", "т", "У", "у", "В", "в", "Х", "х", "З", "з", "Ш", "ш", "Ы", "ы", "Й", "й");
$_POST['nickname'] = str_replace($lat, $rus, $_POST['nickname']);
}
$nickname = mysql_escape_string($_REQUEST['nickname']);
$_SESSION['password'] = $password = mysql_escape_string($_REQUEST['password']);
if(ctype_digit($nickname)){
$q = mysql_query("SELECT * FROM `chat_users` WHERE `id` = ".$nickname." AND `password` = '".md5($password)."';");
}
else{
$q = mysql_query("SELECT * FROM `chat_users` WHERE `nickname` = '".$nickname."' AND `password` = '".md5($password)."';");
}
if(!mysql_num_rows($q))
{
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card title="ERROR" ontimer="/wml">
<timer value="15"/>
<p align="left">
<small>Ошибка авторизации!<br/>
'.$wmlfoot.'
</small>
</p>
</card>
</wml>';
exit;
}
}
else
{
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT * FROM `chat_users` WHERE `id` = ".$id." AND `password` = '".md5($password)."';");
if(!mysql_num_rows($q))
{
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card title="ERROR" ontimer="/wml">
<timer value="15"/>
<p align="left">
<small>Ошибка авторизации!<br/>
'.$wmlfoot.'
</small>
</p>
</card>
</wml>';
exit;
}
}
//END AUTH
//USER DATA
$user = mysql_fetch_assoc($q);
$id = $user['id'];
$nickname = $user['nickname'];
$level = $user['level'];
$status = $user['status'];
$posts = $user['posts'];
$time = $user['time'];
$ip = $user['ip'];
$ua = $user['ua'];
$security = $user['security'];
$fsize = $user['fsize'];
//END USER DATA
$_SESSION['id'] = $id;
//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(!$fsize == 0)
{
$open_tag = '<small>';
$close_tag = '</small>';
}
elseif($fsize == 1)
{
$open_tag = $close_tag = '';
}
elseif($fsize == 2)
{
$open_tag = '<big>';
$close_tag = '</big>';
}
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card title="'.$ttl.'">
<p align="left">
'.$open_tag;
if($security == 1 && ($ip != getenv('REMOTE_ADDR') OR $ua != htmlspecialchars(getenv('HTTP_USER_AGENT'))))
{
echo'Ваш текущий IP и телефон не совпадают с теми, что использовались в последний раз. Предыдущий IP: '.getenv('REMOTE_ADDR').', предыдущий телефон: '.htmlspecialchars(getenv('HTTP_USER_AGENT')).'.<br/>';
}
//ONLINE
$online = time() + 60;
mysql_query("UPDATE `chat_users` SET `time` = ".$online.", `place` = 0, `ip` = '".getenv('REMOTE_ADDR')."', `ua` = '".mysql_escape_string(htmlspecialchars(getenv('HTTP_USER_AGENT')))."' WHERE `id` = ".$id);
//END ONLINE
if($level == 5) echo "<a href=\"/superadmin.php?".SID."&ver=wml&pass=".$passadmin."\">".MENU_SADMIN."</a><br/>\n";
if($level == 4) echo "<a href=\"/admin.php?".SID."&ver=wml&pass=".$passadmin."\">".MENU_ADMIN."</a><br/>\n";
if($level == 3) echo "<a href=\"/smoder.php?".SID."&ver=wml\">".MENU_SMODER."</a><br/>• <a href=\"/rules/smoder_rules.php?".SID."&ver=html\">Правила Модеров</a><br/>\n";
if($level == 2) echo "<a href=\"/moder.php?".SID."&ver=wml\">".MENU_MODER."</a><br/>• <a href=\"/rules/moder_rules.php?".SID."&ver=html\">Правила Киллеров</a><br/>\n";
if($level == 1) echo "<a href=\"/vip.php?".SID."&ver=wml\">".MENU_VIP."</a><br/>• <a href=\"/rules/vip_rules.php?".SID."&ver=html\">Правила VIP</a><br/>\n";
//Приветствие
$h = date('H');
if(time() > $time + 3600)
{
if ($h >= 0 && $h <= 4) echo "Доброй ночи, $nickname!<br/>";
if ($h > 4 && $h < 12) echo "Доброе утро, $nickname!<br/>";
if ($h >= 12 && $h < 18) echo "Добрый день, $nickname!<br/>";
if ($h >= 18 && $h < 22) echo "Добрый вечер, $nickname!<br/>";
if ($h >= 22 && $h < 0) echo "Доброй ночи, $nickname!<br/>";
}
//Конец приветствия
//LETTERS
$newto = mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_letters` WHERE `id` = ".$id." AND `to` = ".$id." AND `read` = 0;"), 0);
$to = mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_letters` WHERE `id` = ".$id." AND `to` = ".$id), 0);
//END LETTERS
//ONLINE IN CHAT
$online = mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `time` > ".time()), 0);
//END ONLINE
//Meets , news
$news = mysql_result(mysql_query('SELECT COUNT(*) FROM `chat_news`'), 0);
$vstrechi = mysql_result(mysql_query('SELECT COUNT(*) FROM `chat_vstrechi`'), 0);
$stixi = mysql_result(mysql_query('SELECT COUNT(*) FROM `chat_stix`'), 0);
//$ob = mysql_result(mysql_query('SELECT COUNT(*) FROM `chat_obyav`'), 0);
$mets = mysql_result(mysql_query('SELECT COUNT(*) FROM `chat_meets`'), 0);
//
$in_embassies = 0;
$sql = mysql_query("SELECT `id` FROM `chat_rooms` WHERE `type` = 2;");
while($array = mysql_fetch_array($sql))
{
$rid = $array['id'];
$query = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `time` > ".time()." AND `place` = '".$rid."';");
$in_embassies = $in_embassies + mysql_result($query, 0);
}
include("prazdnik.php");
$ob = mysql_query("SELECT * FROM `chat_obyav` ORDER BY `id` DESC;");
if(mysql_num_rows($ob) != 0)
{ print "<fieldset>";
echo "Объявления:<br/>\n";
}
while($obyav = @mysql_fetch_array($ob))
{
$nid = $obyav['id'];
$name = $obyav['name'];
$name = htmlspecialchars($name,ENT_QUOTES);
echo "<b><a href=\"/obyav/wml/$nid\">".$name."</a></b><br/>\n";
print "</fieldset>";
}
print "<fieldset>";
echo "Информация: <br/>";
echo "• <a href=\"/gazeta/wml\">Газета чата</a><br/>\n";
echo "• <a href=\"/rules/wml\">Правила чата</a><br/>\n";
//echo "• <a href=\"/faq/wml/govenment\">Администрация</a><br/>\n";
//echo "• <a href=\"/stats/wml\">Статистика</a><br/>\n";
if($news != 0)
echo "• <a href=\"/allnews/wml\">Новости</a> (".$news.")<br/>\n";
echo "• <a href=\"/vstrechi/wml\">Встречи</a> (".$vstrechi.")<br/>\n";
echo "• <a href=\"/stixi/wml\">СТИХИ</a> (".$stixi.")<br/>\n";
if($mets != 0)
echo "• <a href=\"/meets/wml\">".MENU_MEETS."</a><br/>\n";
print "</fieldset>";
print "<fieldset>";
echo "Личное:<br/>";
echo "• <a href=\"/kabinet/wml\">Личный кабинет</a><br/>\n";
echo "• <a href=\"/go/".$_GET['ver']."/".$id."/".$_SESSION['password']."\">Сделать закладку</a><br/>\n";
if($newto != 0)
echo "• <a href=\"/letters/wml\">".MENU_MAILBOX." ($newto)</a><br/>\n";
print "</fieldset>";
print "<fieldset>";
echo "Полезное:<br/>";
echo "• <a href=\"/bank/wml\">".MENU_BANK."</a><br/>\n";
echo "• <a href=\"/magazin/wml\">".MENU_MAGAZIN."</a><br/>\n";
echo "• <a href=\"/galery/wml\">Фото галерея</a><br/>\n";
echo "• <a href=\"/videogalery/wml\">Видео галерея</a><br/>\n";
print "</fieldset>";
print "<fieldset>";
echo "Найти:<br/>";
echo "• <a href=\"/online/wml\">".MENU_ONLINE." ($online)</a><br/>\n";
echo "• <a href=\"/search/wml\">".MENU_SEARCH."</a><br/>\n";
print "</fieldset>";
print "<fieldset>";
echo "Развлечения <br/>";
echo "• <a href=\"/games/dice/wml\">".GAMES_DICE."</a><br/>\n";
echo "• <a href=\"/games/ugadaika/wml\">".GAMES_UGADAI."</a><br/>\n";
print "</fieldset>";
//posol ROOMS
print "<fieldset>";
echo "Загран Комнаты:<br/>";
echo "• <a href=\"/embassies/wml\">".ROOMS_EMBASSIES." </a>(".$in_embassies.")<br/>";
print "</fieldset>";
//PUBLIC ROOMS
print "<fieldset>";
echo "Комнаты:<br/>";
$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";
}
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/$rid/wml\">".$rname." </a>(".$inroom.")<br/>\n";
}
else
{
echo "• <a href=\"/room/$rid/wml\">".$rname." </a>(".$inroom.")<br/>\n";
}
}
//END ROOMS
$sql = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `intim` >= ".time().";");
$intim = mysql_result($sql, 0);
echo "• <a href=\"/key/wml\"><b>".ROOMS_INTIM."* </b></a>($intim)<br/>\n";
//ROOMS FOR MODERATORS
if($level != 0)
{
$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/$rid/wml\">".$rname." </a>(".$inroom.")<br/>\n";
}
if(mysql_num_rows($q) != 0)
{
}
}
// inkognito
$q = mysql_query("SELECT * FROM `chat_rooms` WHERE `type` = 5 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/$rid/wml\"><b>".$rname." </b></a>(".$inroom.")<br/>\n";
}
if(mysql_num_rows($q) != 0)
{
}
print "</fieldset>";
//END ROOMS
print "<fieldset>";
echo "Другое:<br/>";
echo "• <a href=\"/faq/wml/smiles\">Смайлы</a><br/>\n";
echo "• <a href=\"/faq/wml\">".MENU_FAQ."</a><br/>\n";
print "</fieldset>";
$q = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `time` > '".time()."' AND `place` = 0;");
$inmenu = mysql_result($q, 0);
$q = mysql_query("SELECT `nickname`, `level`, `id` FROM `chat_users` WHERE `time` > '".time()."' AND `place` = 0;");
print "<fieldset>";
echo "В прихожей:\n";
$c = 0;
while($nick = mysql_fetch_array($q))
{
if($nick['level'] == 5 and $nick['id'] == 1)
{
$nick['nickname'] = "".$nick['nickname']."";
}
elseif($nick['level'] == 5)
{
$nick['nickname'] = "".$nick['nickname']." (А)";
}
if($nick['level'] == 4)
{
$nick['nickname'] = "".$nick['nickname']." (А)";
}
if($nick['level'] == 3)
{
$nick['nickname'] = "".$nick['nickname']." (М)";
}
if($nick['level'] == 2)
{
$nick['nickname'] = "".$nick['nickname']." (К)";
}
if($nick['level'] == 1)
{
$nick['nickname'] = "".$nick['nickname']." (V)";
}
if($nick['invisible'] == 1 and $level != 5)
{}
else
{
echo $nick['nickname'];
if($level >= 4 && $nick['invisible'] == 1) echo " (невидимый)";
}
$c++;
if($c != $inmenu)
{
echo ", ";
}
else
{
echo "<br/>\n";
}
}
print "</fieldset>";
echo "<a href=\"/menu/html/$ref\">".VERSION_HTML."</a> | ".VERSION_WML."<br/>\n";
echo $close_tag;
include('banners/other');
echo"$wmlfoot";
list($msec, $sec) = explode(chr(32), microtime());
echo "Speed ".round(($sec+$msec)-$headtime,5)." sec.<br/>\n";
echo "</p></card></wml>";
break;
////////////////////////////////////////////////////////
//HTML VERSION
////////////////////////////////////////////////////////
case 'html':
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-revalidate");
//AUTH
if(isset($_POST['action']) or ($_GET['action']))
{
if($_POST['translit'] == "true")
{
$lat = array("''", "'", "\"\"", "\"", "CH", "ch", "SC", "sc", "YE", "ye", "YU", "yu", "YA", "ya", "YO", "yo", "A", "a", "B", "b", "C", "c", "D", "d", "E", "e", "F", "f", "G", "g", "H", "h", "I", "i", "J", "j", "K", "k", "L", "l", "M", "m", "N", "n", "O", "o", "P", "p", "R", "r", "S", "s", "T", "t", "U", "u", "V", "v", "H", "h", "Z", "z", "W", "w", "X", "x", "Y", "y");
$rus = array("Ь", "ь", "Ъ", "ъ", "Ч", "ч", "Щ", "щ", "Э", "э", "Ю", "ю", "Я", "я", "Ё", "ё", "А", "а", "Б", "б", "Ц", "ц", "Д", "д", "Е", "е", "Ф", "ф", "Г", "г", "Х", "х", "И", "и", "Ж", "ж", "К", "к", "Л", "л", "М", "м", "Н", "н", "О", "о", "П", "п", "Р", "р", "С", "с", "Т", "т", "У", "у", "В", "в", "Х", "х", "З", "з", "Ш", "ш", "Ы", "ы", "Й", "й");
$_POST['nickname'] = str_replace($lat, $rus, $_POST['nickname']);
}
$nickname = mysql_escape_string($_REQUEST['nickname']);
$_SESSION['password'] = $password = mysql_escape_string($_REQUEST['password']);
if(ctype_digit($nickname)){
$q = mysql_query("SELECT * FROM `chat_users` WHERE `id` = ".$nickname." AND `password` = '".md5($password)."';");
}
else{
$q = mysql_query("SELECT * FROM `chat_users` WHERE `nickname` = '".$nickname."' AND `password` = '".md5($password)."';");
}
if(!mysql_num_rows($q))
{
echo $css;
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">Ошибка</div>';
echo "<div class=\"d5\">Ошибка авторизации!</div>\n";
echo'<div class="d3">';
echo"$sitefoot";
echo'</div>';
echo "</body></html>";
exit();
}
}
else
{
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT * FROM `chat_users` WHERE `id` = ".$id." AND `password` = '".md5($password)."';");
if(!mysql_num_rows($q))
{
echo $css;
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">Ошибка</div>';
echo "<div class=\"d5\">Ошибка авторизации!</div>\n";
echo'<div class="d3">';
echo"$sitefoot";
echo'</div>';
echo "</body></html>";
exit();
}
}
//END AUTH
//USER DATA
$user = mysql_fetch_array($q);
$id = $user['id'];
$nickname = $user['nickname'];
$level = $user['level'];
$status = $user['status'];
$time = $user['time'];
$fsize = $user['fsize'];
$ip = $user['ip'];
$ua = $user['ua'];
$security = $user['security'];
//END USER DATA
$_SESSION['id'] = $id;
if($fsize == 0)
{
$fsize = "small";
}
if($fsize == 1)
{
$fsize = "normal";
}
if($fsize == 2)
{
$fsize = "large";
}
echo "$css";
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">'.$ttl.'</div>';
echo'<div class="d1">';
//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($security == 1 && ($ip != getenv('REMOTE_ADDR') OR $ua != htmlspecialchars(getenv('HTTP_USER_AGENT'))))
{
echo'</div>';
echo'<div class="d2">';
echo'Ваш текущий IP и телефон не совпадают с теми, что использовались в последний раз. Предыдущий IP: '.getenv('REMOTE_ADDR').', предыдущий телефон: '.getenv('HTTP_USER_AGENT').'.';
echo'</div>';
$online = time() + 60;
mysql_query("UPDATE `chat_users` SET `time` = '".$online."', `place` = 0, `ip` = '".getenv('REMOTE_ADDR')."', `ua` = '".htmlspecialchars(getenv('HTTP_USER_AGENT'))."' WHERE `id` = '".$id."';");
}
//ONLINE
$online = time() + 60;
$update = mysql_query("UPDATE `chat_users` SET `time` = '".$online."', `place` = 0, `ip` = '".getenv('REMOTE_ADDR')."', `ua` = '".htmlspecialchars(getenv('HTTP_USER_AGENT'))."' WHERE `id` = '".$id."';");
//END ONLINE
if($level == 5) echo "• <a href=\"/superadmin.php?".SID."&ver=html&pass=".$passadmin."\">Супер-Админка</a><br/>\n";
if($level == 4) echo "• <a href=\"/admin.php?".SID."&ver=html&pass=".$passadmin."\">Админка</a><br/>\n";
if($level == 3) echo "• <a href=\"/smoder.php?".SID."&ver=html\">Модерка</a><br/>• <a href=\"/rules/smoder_rules.php?".SID."&ver=html\">Правила Модеров</a><br/>\n";
if($level == 2) echo "• <a href=\"/moder.php?".SID."&ver=html\">Мини-Модерка</a><br/>• <a href=\"/rules/moder_rules.php?".SID."&ver=html\">Правила Киллеров</a><br/>\n";
if($level == 1) echo "• <a href=\"/vip.php?".SID."&ver=html\">VIP-меню</a><br/>• <a href=\"/rules/vip_rules.php?".SID."&ver=html\">Правила VIP</a><br/>\n";
//Приветствие
$h = date('H');
if(time() > $time + 3600)
{
if ($h >= 0 && $h <= 4) echo "Доброй ночи, $nickname!<br/>";
if ($h > 4 && $h < 12) echo "Доброе утро, $nickname!<br/>";
if ($h >= 12 && $h < 18) echo "Добрый день, $nickname!<br/>";
if ($h >= 18 && $h < 22) echo "Добрый вечер, $nickname!<br/>";
if ($h >= 22 && $h < 0) echo "Доброй ночи, $nickname!<br/>";
}
//Конец приветствия
include("prazdnik.php");
echo'</div>';
//
$ob = mysql_query("SELECT `id`, `name` FROM `chat_obyav` ORDER BY `id` DESC;");
if(mysql_num_rows($ob) != 0)
{
echo '<div class="d2">Объявления:</div>';
}
while($obyav = @mysql_fetch_array($ob))
{
$nid = $obyav['id'];
$name = $obyav['name'];
$name = htmlspecialchars($name,ENT_QUOTES);
echo "<a href=\"/obyav/html/$nid\">".$name."</a><br/>\n";
}
echo'<div class="d2">Информация</div>';
echo'<div class="d1">';
//LETTERS
$query = mysql_query("SELECT COUNT(*) FROM `chat_letters` WHERE `id` = '".$id."' AND `to` = '".$id."' AND `read` = 0;");
$newto = mysql_result($query, 0);
$query = mysql_query("SELECT COUNT(*) FROM `chat_letters` WHERE `id` = '".$id."' AND `to` = '".$id."';");
$to = mysql_result($query, 0);
//END LETTERS
//ONLINE IN CHAT
$query = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `time` > ".time().";");
$online = mysql_result($query, 0);
//END ONLINE
$in_embassies = 0;
$sql = mysql_query("SELECT `id` FROM `chat_rooms` WHERE `type` = 2;");
while($array = mysql_fetch_array($sql))
{
$rid = $array['id'];
$query = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `time` > ".time()." AND `place` = '".$rid."';");
$in_embassies = $in_embassies + mysql_result($query, 0);
}
//Meets , news
$query = mysql_query("SELECT COUNT(*) FROM `chat_news`");
$news = mysql_result($query, 0);
$queryne = mysql_query("SELECT COUNT(*) FROM `chat_vstrechi`");
$vstrechi = mysql_result($queryne, 0);
$querym = mysql_query("SELECT COUNT(*) FROM `chat_meets`");
$mets = mysql_result($querym, 0);
$queryst = mysql_query("SELECT COUNT(*) FROM `chat_stix`");
$stixi = mysql_result($queryst, 0);
//
echo "• <a href=\"/gazeta/html\">Газета чата</a><br/>\n";
echo "• <a href=\"/rules/html\">Правила чата</a><br/>\n";
//echo "• <a href=\"/faq/html/govenment\">Администрация</a><br/>\n";
//echo "• <a href=\"/stats/html\">Статистика</a><br/>\n";
if($news != 0)
echo "• <a href=\"/allnews/html\">Новости</a> (".$news.")<br/>\n";
echo "• <a href=\"/vstrechi/html\">Встречи</a> (".$vstrechi.")<br/>\n";
echo "• <a href=\"/stixi/html\">СТИХИ</a> (".$stixi.")<br/>\n";
if($mets != 0)
echo "• <a href=\"/meets/html\">".MENU_MEETS."</a><br/>\n";
echo'</div>';
echo'<div class="d2">Личное</div>';
echo'<div class="d1">';
echo "<img src=\"/res/icons/kabinet.png\" alt=\".\" />\n";
echo "<a href=\"/kabinet/html\">Личный кабинет</a><br/>\n";
echo "<img src=\"/res/icons/link.gif\" alt=\".\" />\n";
echo "<a href=\"/go/".$_GET['ver']."/".$id."/".$_SESSION['password']."\">Сделать закладку</a><br/>\n";
if($newto != 0)
echo "<img src=\"/res/icons/mail.png\" alt=\".\" />\n";
if($newto != 0)
echo "<a href=\"/letters/html\">".MENU_MAILBOX." ($newto)</a>\n";
if($newto != 0)
echo "<img src=\"/res/icons/new.gif\" alt=\".\" /><br/>\n";
echo'</div>';
echo'<div class="d2">Полезное</div>';
echo'<div class="d1">';
echo "<img src=\"/res/icons/bank2.png\" alt=\".\" />\n";
echo "<a href=\"/bank/html\">".MENU_BANK."</a><br/>\n";
echo "<img src=\"/res/icons/shop.png\" alt=\".\" />\n";
echo "<a href=\"/magazin/html\">".MENU_MAGAZIN."</a><br/>\n";
echo "<img src=\"/res/icons/foto.png\" alt=\".\" />\n";
echo "<a href=\"/galery/html\">Фото галерея</a><br/>\n";
echo "<img src=\"/res/icons/new.gif\" alt=\".\" />\n";
echo "<a href=\"/videogalery/html\">Видео галерея</a><br/>\n";
echo' </div>';
echo'<div class="d2">Найти</div>';
echo'<div class="d1">';
echo "<img src=\"/res/icons/online.png\" alt=\".\" />\n";
echo "<a href=\"/online/html\">".MENU_ONLINE." ($online)</a><br/>\n";
echo "<img src=\"/res/icons/search.png\" alt=\".\" />\n";
echo "<a href=\"/search/html\">".MENU_SEARCH."</a><br/>\n";
echo' </div>';
echo'<div class="d2">Развлечения</div>';
echo'<div class="d1">';
echo "<img src=\"/res/icons/game.png\" alt=\".\" />\n";
echo "<a href=\"/games/dice/html\">".GAMES_DICE."</a><br/>\n";
echo "<img src=\"/res/icons/game2.png\" alt=\".\" />\n";
echo "<a href=\"/games/ugadaika/html\">".GAMES_UGADAI."</a><br/>\n";
echo'</div>';
//posol ROOMS
echo'<div class="d2">Загран Комнаты</div>';
echo'<div class="d1">';
echo "• <a href=\"/embassies/html\">".ROOMS_EMBASSIES." </a>(".$in_embassies.")<br/>";
echo'</div>';
//PUBLIC ROOMS
echo'<div class="d2">Комнаты</div>';
echo'<div class="d1">';
$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";
}
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/$rid/html\">".$rname." </a>(".$inroom.")<br/>\n";
}
else
{
echo "• <a href=\"/room/$rid/html\">".$rname." </a>(".$inroom.")<br/>\n";
}
}
//END ROOMS
$sql = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `intim` >= ".time().";");
$intim = mysql_result($sql, 0);
echo "• <a href=\"/key/html\"><b>".ROOMS_INTIM."*</b> </a>($intim)<br/>\n";
//ROOMS FOR MODERATORS
if($level != 0)
{
$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/$rid/html\">".$rname." </a>(".$inroom.")<br/>\n";
}
if(mysql_num_rows($q) != 0)
{
}
}
//inkognito
$q = mysql_query("SELECT * FROM `chat_rooms` WHERE `type` = 5 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/$rid/html\"><b>".$rname." </b></a>(".$inroom.")<br/>\n";
}
if(mysql_num_rows($q) != 0)
{
}
//END ROOMS
echo '</div>';
echo'<div class="d2">Другое</div>';
echo'<div class="d1">';
echo "<img src=\"/res/icons/smile.png\" alt=\".\" />\n";
echo "<a href=\"/faq/html/smiles\">Смайлы</a><br/>\n";
echo "<img src=\"/res/icons/help.png\" alt=\".\" />\n";
echo "<a href=\"/faq/html\">".MENU_FAQ."</a><br/>\n";
echo'</div>';
echo'<div class="d2">';
$q = mysql_query("SELECT COUNT(*) FROM `chat_users` WHERE `time` > '".time()."' AND `place` = 0;");
$inmenu = mysql_result($q, 0);
$q = mysql_query("SELECT `nickname` , `level`, `posts`, `colornick`, `id` FROM `chat_users` WHERE `time` > '".time()."' AND `place` = 0;");
echo"В прихожей: ";
$c = 0;
while($nick = mysql_fetch_array($q))
{
if($nick['colornick'])
{
$nick['nickname']="<font color=\"#".$nick['colornick']."\">".$nick['nickname']."</font>";
}
if($nick['level'] == 5 and $nick['id'] == 1)
{
//$nick['nickname'] = $nick['nickname'];
}
elseif($nick['level'] == 5)
{
$nick['nickname'] = $nick['nickname']." (А)";
}
if($nick['level'] == 4 )
{
$nick['nickname'] = $nick['nickname']." (А)";
}
if($nick['level'] == 3)
{
$nick['nickname'] = $nick['nickname']." (М)";
}
if($nick['level'] == 2)
{
$nick['nickname'] = $nick['nickname']." (К)";
}
if($nick['level'] == 1)
{
$nick['nickname'] = $nick['nickname']." (V)";
}
if($nick['id'] == 2 || $nick['id'] == 3 || $nick['id'] == 4)
{
$nick['nickname']=$nick['nickname'];
}
if($nick['invisible'] == 1)
{}
else
{
echo $nick['nickname'];
if($level >= 4 && $nick['invisible'] == 1) echo " (невидимый)";
}
$c++;
if($c != $inmenu)
{
echo ", ";
}
else
{
echo "<br/>\n";
}
}
echo "<a href=\"/menu/wml/$ref\">".VERSION_WML."</a> | ".VERSION_HTML."<br/>\n";
include('banners/other');
echo'</div>';
echo'<div class="d3">';
echo"$sitemenu";
list($msec, $sec) = explode(chr(32), microtime());
echo "[".round(($sec+$msec)-$headtime,5)."] сек.<br/>\n";
echo'</div>';
echo "</body></html>";
break;
}
?>