Файл: chats/history.php
Строк: 65
<?php
//*********************/
//Скрипт переписан админом
//http://waufon.ru Кот * Проги для компа и мобил
//Помогал админ
//http://pfc.h2m.ru/ КОСМОС * Посети непожалееш
//всю эту срань господнюю
//перехуяривали на дыры
//http://rus-waphost.ru/ Nitrix * Супер хост без висов
/*********************/
//require("inc/gzip.php");
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}&pass={$pass}&rm={$rm}&ref={$ref}">Обновить</a>";
echo "<br/>";
## Podschitaem soobchenia
if($rm == 10)
$all_mess=mysql_query("SELECT COUNT(`id`)from intim where pwd='".$pwd."' AND (id_to='0' OR id_to='".$id."' OR id_from='".$id."')");
else
if($level > 7)
$all_mess=mysql_query("SELECT COUNT(`id`) from mess where room='".$room."' OR room = 'all'");
else
$all_mess=mysql_query("SELECT COUNT(`id`) from mess where (room='".$room."' OR room = 'all') AND (id_to='0' OR id_to='".$id."' OR id_from='".$id."')");
$count = mysql_result($all_mess, 0);
## Колво сообщений в комнате###
$total = intval(($count - 1) / $max) + 1;
$p = intval($p);
if( $p < 1) $p = 1;
if($p > $total) $p = $total;
$page=($p-1)*$max;
###
if($rm == 10)
$q_count = mysql_query("SELECT count(*) FROM `users` WHERE `pwd`='".$pwd."' AND `ltime`>'".(time()-300)."' AND `lroom`='$rm';");
else
$q_count = mysql_query("SELECT count(*) FROM `users` WHERE `ltime`>'".(time()-300)."' AND `lroom`='$rm';");
$in_room = mysql_result($q_count, 0);
## Онлайн в комнате###
if($rm == 10)
$q_room="select * from intim where pwd='".$pwd."' AND (id_to='0' OR id_to='".$id."' OR id_from='".$id."') order by id desc limit $page, $max";
else
if($level > 7)
$q_room="select * from mess where room='".$room."' OR room = 'all' order by id desc limit $page,$max";
else
$q_room="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 $page,$max";
$res = mysql_query ($q_room);
## Выбираем сообщения из комнаты
###
$qsetts = mysql_query("select `name` from `setts` where var='".$rm."';");
$setts = mysql_fetch_array($qsetts);
$title=$setts['name'];
print '<div><p align="center"><b>'.$title.' ['.$in_room.']</b></div><br>';
$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}&pass={$pass}&rm={$rm}&dbid={$dbid}&ref={$ref}">{$dblogin}</a></b> [{$dbtime}]>{$dbmsg}<br/>n";
}
else
{
echo "<b><a href="say.php?id={$id}&pass={$pass}&rm={$rm}&dbid={$dbid}&ref={$ref}">{$dblogin}</a>[!]</b> [{$dbtime}]>{$dbmsg}<br/>n";
}
}
print "</div>";
if ( $max <= $i )
{
print "<br/><a href="history.php?id={$id}&pass={$pass}&rm={$rm}&s=".( $s + $max )."">Next»</a>";
}
### НАВИГАЦИЯ ###
echo "<div><a href="history.php?id={$id}&pass={$pass}&rm={$rm}&s={$max}&ref={$ref}">История:</a>";
$st = $p-5;
$end = $p+5;
if ($st < 1) $st=1;
if ($end > $total) $end=$total;
for ($i=$st; $i<=$end; $i++)
{
if ($i==$p)
echo " <b>($p)</b> ";
else
echo "<a href="history.php?rm=$rm&id=$id&pass=$pass&p=$i">$i</a> ";
}
echo "</div><br/>";
###
print "<br/><a href="enter.php?id={$id}&pass={$pass}">Прихожая</a><br/>";
$end = gettime( );
echo "<p align="center">rn[".round( $end - $mystart, 5 )."]";
print "</p></body></html>";
mysql_close( $link );
echo "rn";
?>