Просмотр файла katrinka.ru/newmsg.php

Размер файла: 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 "&#x0438;&#x043B;&#x0438;<br/>\n";
  print "&#x041D;&#x0438;&#x043A;: <input name=\"login\" type=\"text\" value=\"".$login."\" maxlength=\"15\" /><br/>\n";
  print "&#x0421;&#x043E;&#x043E;&#x0431;&#x0449;&#x0435;&#x043D;&#x0438;&#x0435;: <input name=\"message\" type=\"text\" value=\"".$message."\" maxlength=\"800\" /><br/>\n";
?>
<anchor title="Send">&#x041E;&#x0442;&#x043F;&#x0440;&#x0430;&#x0432;&#x0438;&#x0442;&#x044C;<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);
?>