Размер файла: 2.29Kb
<?php
include 'guestbook/mylib.php';
include 'config.php';
$ppp=20;
session_start();
if (!checkagent($_SERVER['HTTP_USER_AGENT'])) { noemul(); exit; }
list ($opname, $chatok) = check_op($_SERVER['REMOTE_ADDR']);
if (!$chatok) { unk_op(); exit; }
header("Cache-Control: no-cache");
header("Content-type: text/vnd.wap.wml");
$lang=$_GET['lang'];
$agent=$_SERVER['HTTP_USER_AGENT'];
if (($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
if (isset($_SESSION['id'])) {
$uid=$_SESSION['id'];
$res=pg_query($conn,"select moder from users where id='$uid';");
$moder=pg_result($res,0,0);
if ($moder) { pg_close($conn); exit; }
}
}
if (!$uid) { pg_close($conn); print "Not logged in"; exit; }
$res=pg_query($conn,"select messages.id,users.login,messages.flag from messages,users where messages.to_u='$uid' and users.id=messages.fr_u order by messages.id desc limit $ppp;");
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.dtd">
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<?php print "<card id=\"Messages\" title=\"Сообщения\">\n"; ?>
<do name="a1" type="options" label="Написать">
<go href="newmsg.php" />
</do>
<do name="a2" type="options" label="Удалить все">
<go href="msgdel.php?id=all" />
</do>
<do name="a3" type="options" label="В Чат">
<go href="chat.php" />
</do>
<do name="a4" type="options" label="На главную">
<go href="/" />
</do>
<p align="center">
<?php
if (!pg_numrows($res)) {
print "Сообщений нет<br/>";
}
$rows=pg_numrows($res);
for ($i=0; $i<$rows; $i++) {
$from=pg_result($res,$i,1);
$mid=pg_result($res,$i,0);
if (!pg_result($res,$i,2)) $flag='*'; else $flag='';
print "<a href=\"readmsg.php?id=".$mid."\">".$flag." ".($i+1).". ".$from."</a><br/>\n";
}
?>
</p>
<?php counters(); ?>
</card>
</wml>
<?php
pg_close($conn);
?>