<?php
//*********************/
//Скрипт переписан админом
//http://waufon.ru  Кот      *  Проги для компа и мобил
//Помогал админ
//http://pfc.h2m.ru/ КОСМОС  * Посети непожалееш
//всю эту срань господнюю
//перехуяривали на дыры
//http://rus-waphost.ru/ Nitrix * Супер хост без висов
/*********************/
require( "inc/conf.inc.php" );
require( "inc/check.php" );
$rm = intval( $rm );
if ( $rm < 0 || 10 < $rm || !isset( $rm ) )
{
    $rm = 10;
}
$room = "room".$rm;
$qsetts = @mysql_query( @"select `name` from `setts` where var='".$rm."';" );
$setts = @mysql_fetch_array( @$qsetts );
$title = $setts['name'];
$max = $row['num_msgs'];
if ( empty( $max ) )
{
    $max = 5;
}
$pwd = $row['pwd'];
echo "<title>Архив</title>";
echo "<style type=\"text/css\">";
echo "body { font-size: {$fs}; color: {$tcol}; background-color: {$bcol} }";
echo "a:link,a:visited { text-decoration: underline; color: {$lcol} }";
echo "div { border-style:solid; border-width: 1px; background-color: {$rcol} }";
echo "</style>";
echo "</head>";
echo "<body>";
echo "<div align=\"center\">{$title}</div>";
echo "<a href=\"room.php?id={$id}&amp;pass={$pass}&amp;rm={$rm}&amp;ref={$ref}\">Обновить</a>";
echo "<br/><div>";
$s = intval( $s );
if ( $s < 0 )
{
    $s = 0;
}
if ( $rm == 10 )
{
    $res = mysql_query( "select * from intim where pwd='{$pwd}' AND (id_to='0' OR id_to='{$id}' OR id_from='{$id}')  order by id desc limit {$s},{$max}" );
}
else
{
    $res = mysql_query( "select * from mess where  (room='{$room}' OR room = 'all') AND (id_to='0' OR id_to='{$id}' OR id_from='{$id}')  order by id desc limit {$s},{$max}" );
}
$i = mysql_num_rows( $res );
while ( $data = @mysql_fetch_array( @$res ) )
{
    $dblogin = $data['login'];
    $dbid = $data['id_from'];
    $dbmsg = $data['msg'];
    $dbtime = date( "H:i", $data['wtime'] );
    $id_to = $data['id_to'];
    if ( $id_to == 0 )
    {
        echo "<b><a href=\"say.php?id={$id}&amp;pass={$pass}&amp;rm={$rm}&amp;dbid={$dbid}&amp;ref={$ref}\">{$dblogin}</a></b> [{$dbtime}]&gt;{$dbmsg}<br/>\n";
    }
    else
    {
        echo "<b><a href=\"say.php?id={$id}&amp;pass={$pass}&amp;rm={$rm}&amp;dbid={$dbid}&amp;ref={$ref}\">{$dblogin}</a>[!]</b> [{$dbtime}]&gt;{$dbmsg}<br/>\n";
    }
}
print "</div>";
if ( $max <= $i )
{
    print "<br/><a href=\"history.php?id={$id}&amp;pass={$pass}&amp;rm={$rm}&amp;s=".( $s + $max )."\">Next&#187;</a>";
}
print "<br/><a href=\"enter.php?id={$id}&amp;pass={$pass}\">Прихожая</a><br/>";
$end = gettime( );
echo "<p align=\"center\">\r\n[".round( $end - $mystart, 5 )."]";
print "</p></body></html>";
mysql_close( $link );
echo "\r\n";
?>