File size: 2.76Kb
<?php
print '<a href="./room.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room='.$room.'&r='.$r.'">Обновить</a><br/>'.
'<a href="#say">Сказать</a><br/>';
$ignor = "";
$qi = @mysql_query("select `user` from `".$px.$itable."` where `loginid`=".$login['id']." and ci= '$ci';");
while($idata = @mysql_fetch_array($qi)) {
$ignor .= "login != '".$idata['user']."', '$ci' AND ";
}
if($room=="vict") {
if($mod=="privat")
$que = @mysql_query("SELECT `login`,`msg`,`time`,`pr_to`,`pr_from` from `".$px.$vtable."` WHERE ".$ignor." (pr_from = '".$login['id']."' OR pr_to = '".$login['id']."') and ci= '$ci' order by id desc limit $num_msgs;");
else
$que = @mysql_query("SELECT `login`,`msg`,`time`,`pr_to`,`pr_from` from `".$px.$vtable."` WHERE ".$ignor." ((pr_to = '' AND pr_from = '') OR (pr_from = '".$login['id']."' OR pr_to = '".$login['id']."')) and ci= '$ci' order by id desc limit $num_msgs;");
} else {
if($mod=="privat")
$que = @mysql_query("SELECT `login`,`msg`,`time`,`pr_to`,`pr_from` from `".$px.$mtable."` WHERE ".$ignor." room = '$room' AND (pr_from = '".$login['id']."' OR pr_to = '".$login['id']."') and ci= '$ci' order by time desc limit $num_msgs;");
else
$que = @mysql_query("SELECT `login`,`msg`,`time`,`pr_to`,`pr_from` from `".$px.$mtable."` WHERE ".$ignor." room = '$room' AND ((pr_to = '' AND pr_from = '') OR (pr_from = '".$login['id']."' OR pr_to = '".$login['id']."')) and ci= '$ci' order by time desc limit $num_msgs;");
}
while($m = @mysql_fetch_array($que)) {
$dblogin = $m['login'];
$dbmsg = $m['msg'];
$dbtime = ($m['time']);
$pr_to = $m['pr_to'];
$pr_from = $m['pr_from'];
$qdblogin = @mysql_query("select `id` from `".$px.$utable."` where `login`='$dblogin' and ci='$ci'");
$db = @mysql_fetch_array($qdblogin);
if(!empty($pr_to)&&!empty($pr_from)) print "<b><a href=\"user.php?ci=$ci&id=$id&pass=$pass&room=$room&dbid=".$db['id']."&r=$r&mod=$mod\">$dblogin</a>[Приват!]</b>\r[".date("H.i",$dbtime)."]>".$dbmsg."<br/>";
else
print "<b><a href=\"./user.php?ci=$ci&id=$id&pass=$pass&room=$room&dbid=".$db['id']."&r=$r\">$dblogin</a></b>\r[".date("H.i",$dbtime)."]>".$dbmsg."<br/>";
}
if($mod=="privat")
print "<a href=\"./history.php?ci=$ci&id=$id&pass=$pass&room=$room&start=$num_msgs&&mod=$mod&r=$r\">История</a>";
else
print "<a href=\"./history.php?ci=$ci&id=$id&pass=$pass&room=$room&start=$num_msgs&r=$r\">".$lang['history']."</a>";
print "<br/><a href=\"./enter.php?ci=$ci&id=$id&pass=$pass\">Прихожая</a><br/>";
?>