View file super2/history.php

File size: 4.89Kb
<?php
require 'connect.php';
require 'header.php';
require 'result.php';

$smset = $row['smiles'];
$max = $row['max'];

$num = intval($_GET['num'])-1;

$set = mysql_fetch_assoc(mysql_query('SELECT * FROM `setting`'));

$rm = intval($_GET['rm']);

$room = 'room'.$rm;

if($rm == 10)
{
$pwd = check($_GET['pwd']);
$takep = '&amp;ref='.$ref.'&amp;pwd='.$pwd;
}
else
{$takep = '&amp;ref='.$ref;}

if($row['fsize'] == 'small')
{$fsize1 = '<small>'; $fsize2 = '</small>';}
elseif($row['fsize'] == 'big')
{$fsize1 = '<big>'; $fsize2 = '</big>';}
else
{$fsize1 = null; $fsize2 = null;}

if($row['wap'] == 0)
{
print $top.'
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="history" title="История">
<do type="options" name="refresh" label="Обновить">
<go href="chat.php?id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.$takep.'"/></do>
<p>
'.$fsize1.'
<a href="chat.php?id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.$takep.'#add">Сказать</a><br/>
<a href="chat.php?id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.$takep.'">Обновить</a><br/>---<br/>';
}
else
{
if(substr_count($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
{header('Content-type: text/html; charset=utf-8');}
else
{header('Content-type: application/xhtml+xml; charset=utf-8');}

if($row['fsize'] == 'small')
{$fsize1 = '<div style="font-size:8pt">';}
elseif($row['fsize'] == 'big')
{$fsize1 = '<div style="font-size:12pt">';}
else
{$fsize1 = '<div>';}
$fsize2 = '</div>';

print $top_xhtml.'
<head>
<title>История</title>
<meta http-equiv="Cache-Control" content="no-cache,no-store,must-revalidate"/>
<link rel="stylesheet" type="text/css" href="'.$row['wap'].'.css"/>
</head><body>
'.$fsize1.'
<div class="border"><a href="#add">Сказать</a><br/></div>
<div class="border"><a href="chat.php?id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.$takep.'">Обновить</a><br/></div>';
}

if(empty($num))
{$num = 0;}

$bmax = $max*2;
$bnum = $num+1;


if(!$pwd)
{$pwd = 'pub';}

if($rm == 10)
{$res = mysql_query('SELECT time,who,message,messagewosm,messagewoasm,id,towhom,hid,usid FROM `room10` WHERE pwd = "'.$pwd.'" AND (towhom='.$id.' OR towhom="" OR usid='.$id.') ORDER BY `id` DESC LIMIT '.$bnum.','.$bmax);}
elseif($row['level']>6)
{$res = mysql_query('SELECT time,who,message,messagewosm,messagewoasm,id,towhom,hid,usid FROM `'.$room.'` ORDER BY `id` DESC LIMIT '.$bnum.','.$bmax);}
else
{$res = mysql_query('SELECT time,who,message,messagewosm,messagewoasm,id,towhom,hid,usid FROM `'.$room.'` WHERE towhom = "" OR towhom = '.$id.' OR usid='.$id.' ORDER BY `id` DESC LIMIT '.$bnum.','.$bmax);}


$kol = mysql_affected_rows();
$total = $kol-1;
$mread = 0;

while($mread < $max)
{
$data = mysql_fetch_assoc($res);
if(!$data)
{break;}

$date = $data['time'];
$name = $data['who'];
$usid = $data['usid'];
$msg = $data['message'];

if($smset==0 && $data['messagewosm'])
{$msg = $data['messagewosm'];}

if($smset==2 && $data['messagewoasm'])
{$msg = $data['messagewoasm'];}

$time = $data['id'];
$th = $data['towhom'];
$hid = $data['hid'];

$inv = mysql_result(mysql_query('SELECT `inv` FROM `antihack_users` WHERE `id`='.$usid.' LIMIT 1'),0);

if((strpos($row['ignor'], $name.'|') === false) && (!$hid || $id==$usid) && !$inv)
{
if(!$th)
{
if($msg[0].$msg[1].$msg[2] == '/me')
{
print '<strong>*'.$name.'</strong> '.substr($msg,3).'<br/>';
$mread++;
}
else
{
print '<strong><a href="inside.php?id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.'&amp;nk='.$usid.$takep.'">'.$name.'</a></strong><small>('.$date.')&#187;</small>'.$msg.'<br/>';
$mread++;
}
}
elseif($th==$id || $id==$usid || ($row['level']>6 && $show_privat))
{
print '<strong><a href="inside.php?id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.'&amp;nk='.$usid.$takep.'">'.$name.'</a>[P!]</strong><small>('.$date.')&#187;</small>'.$msg.'<br/>';
$mread++;
}
}

}

//mysql_close();

print '---<br/>';

$page_next = $num + $max;
$page_prev = $num - $max;

if($num == 0)
{$total+1;}

if($max < $total)
{print '<a href="history.php?id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.'&amp;num='.$page_next.$takep.'">След. '.$max.'</a><br/>';}

if($num >= $max)
{print '<a href="history.php?id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.'&amp;num='.$page_prev.$takep.'">Пред. '.$max.'</a><br/>';}

if($row['wap'] == 0)
{
print '---<br/><a href="enter.php?id='.$id.'&amp;ps='.$ps.'&amp;ref='.$ref.'">Прихожая</a>
'.$fsize2.'
</p></card></wml>';
}
else
{
print '<div class="border"><a href="enter.php?id='.$id.'&amp;ps='.$ps.'&amp;ref='.$ref.'">Прихожая</a><br/></div>
'.$fsize2.$fsize1.'
<form id="add" action="chat.php?';
if($pwd != 'pub')
{print 'pwd='.$pwd.'&amp;';}
print 'id='.$id.'&amp;ps='.$ps.'&amp;rm='.$rm.'" method="post">
<div>
<textarea name="msg" rows="2" cols="20"></textarea><br/>
<input type="submit" value="Сказать"/>
</div>
</form>
'.$fsize2.'</body></html>';
}
?>