File size: 2.2Kb
<?php
include 'guestbook/mylib.php';
include 'config.php';
session_start();
if (!checkagent($_SERVER['HTTP_USER_AGENT'])) { noemul(); exit; }
list ($opname, $chatok) = check_op($_SERVER['REMOTE_ADDR']);
if (!$chatok) { unk_op(); exit; }
$rpl=htmlspecialchars(trim($_GET['rpl']),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; }
$login='';
$message='';
if ($rpl) {
$res=pg_query($conn,"select users.login,messages.message from messages,users where messages.id='$rpl' and messages.fr_u=users.id and messages.to_u='$uid';");
if (pg_numrows($res)) {
$login=uconv(pg_result($res,0,0));
$message=uconv(pg_result($res,0,1));
}
}
?>
<?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>
<card id="Messages" title="New" newcontext="true">
<p>
<?php
print "ID: <input name=\"to_id\" type=\"text\" value=\"\" maxlength=\"5\" format=\"*N\"/><br/>\n";
print "или<br/>\n";
print "Ник: <input name=\"login\" type=\"text\" value=\"".$login."\" maxlength=\"15\" /><br/>\n";
print "Сообщение: <input name=\"message\" type=\"text\" value=\"".$message."\" maxlength=\"800\" /><br/>\n";
?>
<anchor title="Send">Отправить<go href="msgsend.php" method="post">
<postfield name="to_id" value="$(to_id)"/>
<postfield name="login" value="$(login)"/>
<postfield name="message" value="$(message)"/>
<?php print "<postfield name=\"lang\" value=\"".$lang."\"/>\n"; ?>
</go></anchor>
</p>
</card>
</wml>
<?php
pg_close($conn);
?>