File size: 2.18Kb
<?
require('ini.php');
$link=connect();
@$mod=$_GET['mod'];
$user=login('nick, chat_admin, chat_moder');
mysql_query("update wip_users set loc='chat', chat_room='0' where id='$user[id]';");
head('Чат');
echo '<small>';
switch($mod){
default:
echo 'Привет <b>'.$user['nick'].'</b><br/>';
@$contacts=mysql_fetch_row(mysql_query("select count(id), sum(msg) from wip_contacts where uid='$user[id]';"));
@$online=mysql_fetch_row(mysql_query("select count(id) from wip_users where loc='chat' and chat_room!='0' and chat_online>'".(time()-300)."' and chat_inv!=1;"));
if(@$contacts[1]) echo '<b>Вам поступило '.@$contacts[1].' новых сообщений!</b><br/>';
else $contacts[1] = 0;
echo '<a href="contacts.php?sid='.$sid.'">Контакт-лист</a> ['.$contacts[1].'/'.$contacts[0].']<br/>';
echo '---<br/>';
if($user['chat_admin']) echo '<a href="chat_admin.php?sid='.$sid.'">Админка</a><br/>';
if($user['chat_moder']) echo '<a href="chat_moder.php?sid='.$sid.'">Модерка</a><br/>';
echo '<a href="help.php?sid='.$sid.'&mod=chat_rules">Правила чата</a><br/>';
echo '<a href="chat_online.php?sid='.$sid.'">Кто где?</a> ['.$online[0].']<br/>';
echo '<a href="chat_menu.php?sid='.$sid.'">Личное</a><br/>';
$onl_pos=mysql_fetch_row(mysql_query("select count(u.id) from wip_users as u, wip_chat_rooms as r where u.chat_room=r.id and r.type='pos' and u.chat_online>'".(time()-300)."' and u.chat_inv!=1;"));
echo '<a href="chat_online.php?sid='.$sid.'">Посольства</a> ['.$onl_pos[0].']<br/>';
echo '---<br/>';
$select=mysql_query("select id,name from wip_chat_rooms where type!='pos';");
while($res=mysql_fetch_assoc($select)){
$onl=mysql_fetch_row(mysql_query("select count(id) from wip_users where chat_room='$res[id]' and chat_online>'".(time()-300)."' and chat_inv!=1;"));
echo '<a href="chat_talk.php?sid='.$sid.'&r='.$res['id'].'">'.$res['name'].'</a> ['.$onl[0].']<br/>';
}
break;
}
echo '---<br/>';
echo '<a href="enter.php?sid='.$sid.'">Главное меню</a>';
echo '</small>';
foot();
mysql_close($link);
?>