File size: 2.01Kb
<?php
include 'guestbook/mylib.php';
include 'config.php';
session_start();
$id=htmlspecialchars(trim($_GET['id']),ENT_QUOTES);
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 users.login,messages.message,messages.time,messages.fr_u from messages,users where messages.id='$id' and messages.to_u='$uid' and messages.fr_u=users.id");
if (!pg_numrows($res)) { pg_close($conn); exit; }
$login=uconv(pg_result($res,0,0));
$message=uconv(pg_result($res,0,1));
$time=pg_result($res,0,2);
$fr_u=pg_result($res,0,3);
pg_query($conn,"update messages set flag=1 where id='$id' and flag=0;");
?>
<?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=\"".$login."\">\n"; ?>
<do name="a1" type="options" label="Ответить">
<?php print '<go href="newmsg.php?rpl='.$id.'" />'; ?>
</do>
<do name="a2" type="options" label="К списку">
<go href="messages.php" />
</do>
<do name="a3" type="options" label="Удалить">
<?php print '<go href="msgdel.php?id='.$id.'" />'; ?>
</do>
<p align="center">
<?php
print "From: <a href=\"user_info.php?id=".$fr_u."\">".$login."</a><br/>\n";
print "[".strftime("%R %d %b %G", $time)."]<br/></p><p>\n";
print $message;
?>
</p>
</card>
</wml>
<?php
pg_close($conn);
?>