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

Размер файла: 2.83Kb
<?php
  include '../wap/config.php';
  include 'acl.php';
  list ($aid, $pl) = priv_level();
  header("Cache-Control: no-cache");
  $lang=$_GET['lang'];
  $r=htmlspecialchars(trim($_GET['r']),ENT_QUOTES);
  $mot=1;
?>
<html>
<head>
<title>лФП ЗДЕ</title>
<META HTTP-EQUIV="Refresh" CONTENT="300">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" content="no-cache">
</head>
<?php
  if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass")))
  { ?>
<body>
<p align="center">
&#x041E;&#x0448;&#x0438;&#x0431;&#x043A;&#x0430; &#x043F;&#x043E;&#x0434;&#x043A;&#x043B;&#x044E;&#x0447;&#x0435;&#x043D;&#x0438;&#x044F; &#x043A; &#x0411;&#x0414<br/>
<a href="/">&#x041D;&#x0430; &#x0433;&#x043B;&#x0430;&#x0432;&#x043D;&#x0443;&#x044E;</a>
</p>
</body>
</html>
<?php
	exit;
    }
	$uid=0;
	$access=1;
	print "<body>\n";
	print "<p>\n";
  pg_query($conn,"SET CLIENT_ENCODING TO 'KOI8';");
	
	$res=pg_query($conn,"select id,name_eng,name_rus,flag from chat_rooms order by id;");
	$rows=pg_numrows($res);
	$timex=time()-300;
	$res_cnt_t=pg_query($conn,"select distinct chat.fr_u,users.login,users.id,users.access from chat,users where users.id=chat.fr_u and users.moder=0 and chat.time > '$timex';");
	$total=pg_numrows($res_cnt_t);
			print "<table>\n";
			print "<tr><td>лПНОБФБ</td><td>лФП ФХФ</td></tr>\n";
	for ($i=0; $i<$rows; $i++) {
		$flag=pg_result($res,$i,3);
		$room='';
		$rid=pg_result($res,$i,0);
		if (($rid==16)&&($aid!=1)&&($aid!=2)) continue;
		if ($lang!='eng') $room=pg_result($res,$i,2);
		if (($flag!=1)||(($flag==1)&&($access))) {
			if ($room=='') $room=pg_result($res,$i,1);
			if ($rid!=18) {
				$res_cnt=pg_query($conn,"select distinct chat.fr_u,users.login,users.id,users.access from chat,users where users.id=chat.fr_u and users.moder=0 and chat.time > '$timex' and chat.room='$rid';");
			} else {
				$res_cnt=pg_query($conn,"select distinct chat_tet.fr_u,users.login,users.id,users.access from chat_tet,users where users.id=chat_tet.fr_u and users.moder=0 and chat_tet.time > '$timex';");
			}
			$rows_cnt=pg_numrows($res_cnt);
			print "<tr><td><a href=\"chat.php?r=".$rid."&amp;lang=".$lang."\">".$room." (".$rows_cnt.")</a></td><td>\n";
			if ((!$r)||($r==$rid)) {
				for ($j=0; $j<$rows_cnt; $j++) {
					$uid=pg_result($res_cnt,$j,2);
					$acc=pg_result($res_cnt,$j,3);
					$login=pg_result($res_cnt,$j,1);
					if ($acc==1) $login=sprintf("<i>%s</i>", pg_result($res_cnt,$j,1));
					if (($acc==2)||($acc==3)) $login=sprintf("<b>%s</b>", pg_result($res_cnt,$j,1));
					if ($acc==4) $login=sprintf("<b><i>%s</i></b>", pg_result($res_cnt,$j,1));
					print "<a href=\"user_edit.php?id=".$uid."&amp;r=".$rid."&amp;lang=".$lang."\">".$login."</a> \n";
				}
				print "</td></tr>\n";
			}
		}
	}
	print "</table>\n";
	print "Total: ".$total."<br>\n";
  pg_close($conn);
?>
</p>
</body>
</html>