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

Размер файла: 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=\"&#x0421;&#x043E;&#x043E;&#x0431;&#x0449;&#x0435;&#x043D;&#x0438;&#x044F;\">\n"; ?>
<do name="a1" type="options" label="&#x041D;&#x0430;&#x043F;&#x0438;&#x0441;&#x0430;&#x0442;&#x044C;">
<go href="newmsg.php" />
</do>
<do name="a2" type="options" label="&#x0423;&#x0434;&#x0430;&#x043B;&#x0438;&#x0442;&#x044C; &#x0432;&#x0441;&#x0435;">
<go href="msgdel.php?id=all" />
</do>
<do name="a3" type="options" label="&#x0412; &#x0427;&#x0430;&#x0442;">
<go href="chat.php" />
</do>
<do name="a4" type="options" label="&#x041D;&#x0430; &#x0433;&#x043B;&#x0430;&#x0432;&#x043D;&#x0443;&#x044E;">
<go href="/" />
</do>
<p align="center">
<?php
  if (!pg_numrows($res)) {
   print "&#x0421;&#x043E;&#x043E;&#x0431;&#x0449;&#x0435;&#x043D;&#x0438;&#x0439; &#x043D;&#x0435;&#x0442;<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);
?>