<?php
require'../config.php';
$align='left';
$title='Все сообщения юзера в чате';
aut();
head();
levels(9);
who_add(0,'enter');

switch($mod)
{
default:{
$us_id = intval($_GET['us_id']);
$rm = intval($_GET['rm']);
echo '<a href="allpostroomuser?mod=us_msg&us_id='.$us_id.'>Просмотр всех сообщений</a><br />';
//echo '<form action="allpostroomuser?mod=us_msg" method="GET">
//	<input type="text" name="id"/>
//	<input type="submit" class="ibutton" value="all msg"/></form>';
echo '<a href="allpostroomuser?mod=us_msg_rm&us_id='.$us_id.'&rm='.$rm.'">Просмотр в комнате</a><br />';

break;
}

case 'us_msg_rm':
{
echo 'Посты не найдены';
break;
}


case 'us_msg':
{
$rms = abs(intval($_GET['rm']));
$us_ids= abs(intval($_GET['us_id']));
$mess = @$db->sql_query(@"SELECT msg,color,bb,emo,komu,privat,user_id,user,time,id FROM `message` WHERE `rm` = '".$rms."' AND `user_id` = '".$us_ids."' ORDER BY `id` DESC");

while($msg = @$db->sql_fetchrow($mess))
{
	$text = $msg['msg'];
	//if ($msg['color']>0) $text =  color_msg($text);
	if ($msg['color']>0)
	{
		{
			$text =  color_msg($text);
		}
	}
	if($msg['user_id'] == 3){}
	if ($msg['bb']>0)$text =  bb_msg($text);
	if ($msg['emo']>0)$text = emo_msg($text);
	if (($rooms['tupica']==0) && ($rooms['sartir']==0))if ($rooms['antim']>0)$text = antim($text);
	if ($rooms['antir']>0 and $msg[user_id] != 0)$text = antir($text);
    ///$text = ''.$text.'';
	if ($msg['komu']!=0) 
	{
		if ($user['id']==$msg['komu']) 
		{
			
			$komu = '<b><font color="red">'.user($msg['komu']).'</font></b>,';
			////$text = gbinroom.$text.div;
		}else 
		{
			$komu = user($msg['komu']).',';
		}
	}else
	{
		$komu = '';
	}

	if ($msg['privat']==0)
	{
		$ignorr = mysql_fetch_assoc(mysql_query("Select * from ignor where `ig_id` = '".$msg['user_id']."' and `user_id` = '".$user[id]."'"));
		if ( $user['id'] == $ignorr['user_id'] and $msg['user_id'] == $ignorr['ig_id']){}else
		{
			if ($msg['user_id']!=0)
			{			
				echo nik($msg['user_id'],''.H.'inside?rm='.$rm.'&amp;nk='.$msg['user_id'].'').date("(H:i", $msg['time']).')';
			}else 
			{
				echo '<img src="'.H.'img/bot.gif" alt="" />'.$msg['user'].date("(H:i", $msg['time']).')';
			}
			if ($user['level']>=5)echo '<small><a href="room?rm='.$rm.'&amp;delete='.$msg['id'].'">[X]</a></small>';
			echo '&gt;'.$komu.text($text).'<br />';
		}
	}else if ($msg['privat']==$user['id']||$msg['user_id']==$user['id'])
	{
		$ignorr = mysql_fetch_assoc(mysql_query("Select * from ignor where `ig_id` = '".$msg['user_id']."' and `user_id` = '".$user[id]."'"));
		if ( $user['id'] == $ignorr['user_id'] and $msg['user_id'] == $ignorr['ig_id']){}else
		{
			if ($msg['user_id']!=0)echo nik($msg['user_id'],''.H.'inside?rm='.$rm.'&amp;nk='.$msg['user_id'].'').date("(H:i", $msg['time']).')';
			else echo '<img src="'.H.'img/bot.gif" alt="" />'.$msg['user'].date("(H:i", $msg['time']).')';
			echo '<b>[P!]</b>';
			if ($user['level']>=5)echo '<small><a href="room?rm='.$rm.'&amp;delete='.$msg['id'].'">[X]</a></small>';
			echo '&gt;'.$komu.text($text).'<br />';///////
		}
	} else if (($msg['privat']!=$user['id']||$msg['user_id']!=$user['id']) && $user['level']>=$set['privat'] && $set['privat']!=0)
	{ // Чтение привата супер админами...
		if ($msg['user_id']!=0)echo nik($msg['user_id'],''.H.'inside?rm='.$rm.'&amp;nk='.$msg['user_id'].'').date("(H:i", $msg['time']).')';
		else echo '<img src="'.H.'img/bot.gif" alt="" />'.$msg['user'].date("(H:i", $msg['time']).')';
		echo '<b>[!!!]</b>';
		if ($user['level']>=5)echo '<small><a href="room?rm='.$rm.'&amp;delete='.$msg['id'].'">[X]</a></small>';
		echo '&gt;'.$komu.text($text).'<br />';
	}

}

break;
}

}
echo '<br/>';
if($mod)echo gb.'<a href="sets">Нстройки чата</a>'.div;
echo gb.'<a href="index">В админку</a><br/>'.div;
echo gb.'<a href="'.H.'enter">Прихожая</a>'.div;
info_compress();
echo 'Время:'.$debag->endTimer().' сек<br />'.div;
foot();
?>
