<html>
<head><title>зПУФЕЧБС ЛОЙЗБ WAP УБКФБ</title></head>
<body>
<?php
include '../wap/guestbook/mylib.php';
include '../wap/config.php';
$ppp=25;
if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
echo ("пЫЙВЛБ РПДЛМАЮЕОЙС Л вд!\n");
};
?>
<center><h1>зПУФЕЧБС ЛОЙЗБ WAP УБКФБ</h1></center>
<FORM METHOD=POST ACTION="book_add.php">
<table>
<tr><td>йНС:</td><td>
<select NAME="uid" SIZE=1>
<option value="1" selected>лБФТЙОЛБ</option>
<option value="2">xKing</option>
</select>
</td></tr></table><br>
уППВЭЕОЙЕ:<br>
<TEXTAREA NAME="message" ROWS=10 COLS=60>
<?php echo $message ?>
</TEXTAREA>
<br><br>
<INPUT TYPE=SUBMIT VALUE="рЕТЕУМБФШ">
<INPUT TYPE=RESET VALUE="пЮЙУФЙФШ">
</FORM>
<?php
$offset=$p*$ppp;
$mstate[0]='РХВМЙЛХЕФУС';
$mstate[1]='<font color=red>ое РХВМЙЛХЕФУС</font>';
pg_query($conn,"SET CLIENT_ENCODING TO 'KOI8';");
$res=pg_query($conn,"select count(id) from wapgbk;");
$numrec=pg_result($res,0,0);
$res=pg_query($conn,"select wapgbk.id,wapgbk.mdate,wapgbk.message,wapgbk.ip,wapgbk.agent,wapgbk.mtime,wapgbk.reply,wapgbk.moder,users.login,users.id,users.email,users.moder from wapgbk,users where wapgbk.uid=users.id order by wapgbk.id desc limit $ppp offset $offset;");
$mp=floor(($numrec-1)/$ppp);
print "<center>уФТБОЙГЩ: ";
for ($i=0;$i<=$mp;$i++) if ($i==$p) print $i." "; else print "<a href=\"book.php?p=".$i."\">".$i."</a>\n";
print "<font size=1 face=arial>(чЩЧПД РП ".$ppp." РПУФПЧ ОБ УФТБОЙГХ)</font></center>\n";
for ($i=0;$i<pg_numrows($res);$i++) {
$message=preg_replace("/\n/","<br>",pg_result($res,$i,2));
$reply=preg_replace("/\n/","<br>",pg_result($res,$i,6));
$id=pg_result($res,$i,0);
$name=pg_result($res,$i,8);
ereg ("([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", pg_result($res,$i,5), $regs);
$mtime[0]=sprintf("%s:%s:%s", $regs[1], $regs[2], $regs[3]);
$moder=pg_result($res,$i,7);
if ($moder) $color='gray'; else $color='black';
$ban=pg_result($res,$i,11);
$uid=pg_result($res,$i,9);
if ($ban) {
$status=sprintf("<font color=red>BANNED</font>");
$cstatus=sprintf("<font color=red>BANNED</font>");
} else {
$status=sprintf("<a href=user_ban.php?id=%d>BAN</a>", $uid);
$cstatus=sprintf("<a href=user_banclear.php?id=%d>CLEAR</a>", $uid);
}
echo "<br> <hr>\n<a name=\"".$id."\"></a><b>".pg_result($res,$i,1)." ".$mtime[0]."</b>".
" уППВЭЕОЙЕ <b>".$mstate[$moder]."</b>, ОБРЙУБМ(Б) <a href=\"user_edit.php?id=".$uid."\">".$name."</a>".
" (<a href=\"mailto:".pg_result($res,$i,10)."\">".
pg_result($res,$i,10)."</a>) [".$status."] [".$cstatus."].<p><font color=".$color.">$message</font><br><br>";
if ($reply!='') print "<b>пФЧЕФ:</b><br>".$reply."<br><br>\n";
else {
print "пФЧЕФ:<br>\n";
print "<form method=post action=\"book_reply.php\">\n";
print "<table><tr><td>\n";
print "<textarea name=\"reply\" rows=5 cols=60>\n";
print $name.", ";
print "</textarea></td><td>\n";
print "<input type=hidden name=\"id\" value=\"".$id."\">\n";
print "<input type=checkbox name=\"bymail\" value=\"1\"> лПРЙС ПФЧЕФБ ОБ e-mail<br><br>\n";
print "<input type=submit value=\"пФЧЕФЙФШ\"> \n";
print "<input type=reset value=\"пЮЙУФЙФШ\"></td></tr></table></form>\n";
}
list ($opname, $chatok) = check_op(pg_result($res,$i,3));
echo "<table><tr>".
"<td><font size=\"1\" face=\"arial\"><a href=\"book_del.php?id=".$id."\">хДБМЙФШ РПУФ</a></font></td>".
"<td><font size=\"1\" face=\"arial\"><a href=\"book_edit.php?id=".$id."\">тЕДБЛФЙТПЧБФШ РПУФ</a></font></td>".
"<td><font size=\"1\" face=\"arial\"><b>Host:</b> [".pg_result($res,$i,3)."] ".$opname."</font></td>".
"<td><font size=\"1\" face=\"arial\"><b>Agent:</b> ".pg_result($res,$i,4)."</font></td>".
"</tr></table>";
}
print "<center>уФТБОЙГЩ: ";
for ($i=0;$i<=$mp;$i++) if ($i==$p) print $i." "; else print "<a href=\"book.php?p=".$i."\">".$i."</a>\n";
print "<font size=1 face=arial>(чЩЧПД РП ".$ppp." РПУФПЧ ОБ УФТБОЙГХ)</font></center>\n";
pg_close($conn);
?>
</body>
</html>