View file super2/inbox.php

File size: 2.13Kb
<?php
// Чат GBodr
// Версия: 1.0
// Автор: Gemorroj

require 'connect.php';
require 'header.php';
require 'result.php';

$r = mysql_query('select count(readd) as num from zapiski where (idtowhom = '.$id.')and(ininc = 1)');
$a = mysql_fetch_assoc($r);
$num = $a['num'];
if($num == 0)
{
print $top.'
<card id="error" title="Error" ontimer="chatmail.php?id='.$id.'&amp;ps='.$ps.'&amp;r='.$ref.'">
<timer value="5"/>
<p>
У вас нет входящих писем
</p>
</card>
</wml>';
mysql_close();
exit;
}

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

if($s <= 0)
{$s = 1;}
$mx = round(($num/10)+0.45);
if($s>$mx)
{$s = $mx;}

$ot = (($s-1)*10)+1;
$do = $s*10;
if($do>$num)
{$do = $num;}
$o = $ot-1;
$n = $ot;
if($do == 0)
{$n = $o;}

print $top.'
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="inbox" title="Входящие">
<p>
<small>
Показывает '.$n.'-'.$do.' из '.$num.'<br/>';

$r = mysql_query('Select who,topic,date,klu4,readd from zapiski WHERE (idtowhom = '.$id.')and(ininc = 1) order by time desc LIMIT '.$o.','.$do);
for($i=$ot; $i<=$do; $i++)
{
$a = mysql_fetch_assoc($r);
$fromw = $a ['who'];
$topic = $a ['topic'];
$date = $a ['date'];
$klu4 = $a ['klu4'];
$read = $a ['readd'];

if($read == 1)
{print '<a href="read.php?id='.$id.'&amp;ps='.$ps.'&amp;im='.$klu4.'">'.$fromw.' ('.$topic.')</a> <i>'.$date.'</i><br/>';}
else
{print '<strong><a href="read.php?id='.$id.'&amp;ps='.$ps.'&amp;im='.$klu4.'">'.$fromw.' ('.$topic.')</a></strong> <i>'.$date.'</i><br/>';}
}

mysql_close();

$next = $s+1;
$prev = $s-1;
if($num>$do)
{
$ot = (($next-1)*10)+1;
$do = $next*10;
if($do>$num)
{$do = $num;}

print '<a href="inbox.php?id='.$id.'&amp;ps='.$ps.'&amp;s='.$next.'&amp;ref='.$ref.'">&gt;&gt;'.$ot.'-'.$do.'&gt;&gt;</a><br/>';
}
if($s>1)
{
$ot = (($prev-1)*10)+1;
$do = $prev*10;
print '<a href="inbox.php?id='.$id.'&amp;ps='.$ps.'&amp;s='.$prev.'&amp;ref='.$ref.'">&lt;&lt;'.$ot.'-'.$do.'&lt;&lt;</a><br/>';
}
print '<a href="chatmail.php?id='.$id.'&amp;ps='.$ps.'&amp;ref='.$ref.'">Ваши письма</a><br/>
<a href="enter.php?id='.$id.'&amp;ps='.$ps.'">Прихожая</a>
</small>
</p>
</card>
</wml>';
?>