Размер файла: 3.55Kb
<?php
require_once "config.php";
require_once "function.php";
echo '<link rel="StyleSheet" type="text/css" href="style.css">';
$rand=rand(111,999);
echo "<center>";
echo '<div class="title">ГоСтЕвАя КнИгА</div>';
echo "<a href=\"admin.php\">Админка</a><br><a href=\"add.php?act=index\">Написать</a>";
echo ' | ';
echo "<a href=\"guest.php?$rand\">Обновить</a><br>";
$qnum = mysql_query("SELECT `str` FROM `setting`;");
$strnum=mysql_fetch_array($qnum);
$num = $strnum['str'];
if(isset($_SESSION['admin'])) {
echo '<a href="edit.php?act=alldel">Очистить гостевую!</a><br><a href="edit.php?act=alldelbans">Разбанить всех!</a><br>';
}
echo "</center>";
if(empty($_GET['start'])) {
$start=0;
} else {
$start=$_GET['start'];
}
if(!ctype_digit($start)) {
$start=0;
}
$q="SELECT count(*) FROM guest";
$total=mysql_query($q);
$num=(int)$num;
$q="SELECT * FROM guest ORDER BY id DESC LIMIT $start,$num";
$soob=mysql_query($q);
$count=mysql_result($total,0);
if($count<1) {
echo '<font color="red">Сообщений нет!<br> Будешь первым?!</font><br>';
} else {
echo "<font color=\"red\">Сообщений в гостевой $count!</font><br>";
}
while($v=mysql_fetch_array($soob)) {
$id=trim($v['id']);
$id=(int)$id;
$name=trim($v['name']);
$mail=trim($v['mail']);
$msg=trim($v['msg']);
$ua=trim($v['ua']);
$ip=trim($v['ip']);
$dt=trim($v['dt']);
$otvet=trim($v['otvet']);
echo "<font color=\"FFFF00\">$name/$dt</font><br>";
if($mail!="") {
echo "$mail<br>";
}
echo "<font color=\"white\">".smiles($msg)."</font><br><font color=\"696969\">$ua</font><br>";
if(isset($_SESSION['admin'])) {
echo '<font color="696969">IP: '.$ip.'</font><br>';
}
if($otvet!="no") {
echo "<font color=\"red\"><br>ОТВЕТ АДМИНА: $otvet</font>";
}
if(isset($_SESSION['admin'])) {
echo '<table><tr><form action="edit.php?act=delpost" method="POST">';
echo '<br><input type="hidden" name="id" value="'.$id.'">
<input type="submit" value="Del"></form>';
echo '<form action="edit.php" method="POST">';
echo '<input type="hidden" name="id" value="'.$id.'">
<input type="submit" value="edit"></form>';
echo '<form action="edit.php?act=ban" method="POST">
<input type="hidden" name="id" value="'.$id.'">
<input type="submit" value="Ban"></form></tr></table>';
echo "--------------------<br>";
} else {
echo "<br>--------------------<br>";
}
}
echo "<center>";
if($start!=0) {
echo '<a href="guest.php?start='.($start-$num).'">Назад</a>';
} else {
echo 'Назад';
}
echo ' | ';
if($count>$start +$num) {
echo '<a href="guest.php?start='.($start+$num).'">Далее</a><br>';
} else {
echo 'Далее<br>';
}
echo "</center>";
include_once "foot.php";
?>