View file chatservice/letters/inbox.php

File size: 2.4Kb
<?php
header ("Content-type:text/vnd.wap.wml; charset=utf-8");

print '<?xml version="1.0" encoding="utf-8"?>'.
'<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"'.
' "http://www.wapforum.org/DTD/wml_1.1.xml">'.
'<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>';

include "../ini.php";

$login = autorize();

print '<card title="&#1042;&#1093;&#1086;&#1076;&#1103;&#1097;&#1080;&#1077;">'.
'<p>';

if($login) {
if(empty($start)) $start = 0;
if($start < 0) $start = 0;
//&#1087;&#1080;&#1089;&#1077;&#1084; &#1085;&#1072; &#1089;&#1090;&#1088;&#1072;&#1085;&#1080;&#1094;&#1091;
$pnumber = 5;
//&#1079;&#1072;&#1087;&#1088;&#1086;&#1089;&#1099; &#1074; &#1073;&#1076;
$tot = @mysql_query("select count(*) from `".$px.$ltable."` where to_user='".$login['login']."' and ci='$ci';");
$lets = @mysql_query("select * from `".$px.$ltable."` where to_user='".$login['login']."' and ci='$ci' order by time desc limit ".$start.",".$pnumber.";");
if($tot && $lets) {
$total = @mysql_fetch_array($tot);
$count = $total['count(*)'];
while($data = @mysql_fetch_array($lets))
{
$from=$data['from_user'];
$to=$data['to_user'];
$time=$data['time'];
$subject=$data['subject'];
$letter=$data['letter'];
$new=$data['new'];
$id_letter=$data['id'];
$time=date("d.m.Y H:i", $time);
if($new) {
        print "<b><a href=\"view.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;id_letter=$id_letter\">$subject [$time]</a></b><br/>";
        }
else {
        print "<a href=\"view.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;id_letter=$id_letter\">$subject [$time]</a><br/>";
        }
}
}
if($start > 0)
print "<a href=\"?ci=$ci&amp;id=$id&amp;pass=$pass&amp;room=$room&amp;start=".($start-$pnumber)."\">&#1055;&#1088;&#1077;&#1076;&#1099;&#1076;&#1091;&#1097;&#1080;&#1077;</a>";
if($count > $start + $pnumber)
print "<a href=\"?ci=$ci&amp;id=$id&amp;pass=$pass&amp;room=$room&amp;start=".($start+$pnumber)."\"><br/>&#1057;&#1083;&#1077;&#1076;&#1091;&#1102;&#1097;&#1080;&#1077;</a>";
print "<anchor>&#1053;&#1072;&#1079;&#1072;&#1076;<prev/></anchor><br/>";
print "<a href=\"../enter.php?ci=$ci&amp;id=$id&amp;pass=$pass\">&#1055;&#1088;&#1080;&#1093;&#1086;&#1078;&#1072;&#1103;</a><br/>";
                } else { print "&#1055;&#1072;&#1088;&#1086;&#1083;&#1100; &#1085;&#1077; &#1087;&#1086;&#1076;&#1093;&#1086;&#1076;&#1080;&#1090;!"; }
print '</p>'.
'</card>'.
'</wml>';
ob_end_flush();
?>