View file guest/index.php

File size: 1.57Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
function myErrorHandler ($errno, $errstr, $errfile, $errline) {}
set_error_handler("myErrorHandler");
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);
extract($HTTP_SESSION_VARS);
session_name("ID");
session_start();
include"../inc/conf.php";
$title="Книга отзывов и предложений";
include"../inc/head.php";
$max_mess=7;
include "../inc/conf_db.php";

$u = mysql_query("select * from `guestbook` ");
$counter = MYSQL_NUMROWS($u);

if (empty($page)) $page = 0;
if ($page < 0) $page = 0;

echo"<a href=\"add.php\">Добавить сообщение</a>";
$m = mysql_query("select * from `guestbook` ORDER BY `id` DESC  LIMIT ".$page." ,".$max_mess."");

$count = MYSQL_NUMROWS($m);

if($counter==0){
echo"<br/><br/>Сообщений нет!<br/><br/>";}
if($counter>0){
while($mess = mysql_fetch_array($m)){

echo"<p align=\"left\">";
echo"&#187;<font color=\"blue\">$mess[author]</font>
<small><font color=\"#004080\">[$mess[date]]</font></small><br/>
<b><font color=\"#346969\">$mess[mess]</font></b><br/><small>
<font color=\"red\">[$mess[usagent]]</font></small>";
echo"</p>";
}}

if ($page > 0)  echo '<a href="'.$PHP_SELF.'?page='.($page - $max_mess).'">«назад</a> ';
if ($counter > $page + $max_mess)  echo ' <a href="'.$PHP_SELF.'?page='.($page + $max_mess).'">далее&#187;</a>';

echo"<br/>";

echo"Всего сообщений: $counter";
echo"<br/>";
include"../inc/foot.php";
?>