File size: 6.34Kb
<?
include "setup.php";
do_header();
$num = 7; // колво объектов на страницу
$page = intval($_GET['page']);
if ($page == '') {$page=1;}
$result = mysql_query("SELECT COUNT(*) FROM gb ");
$c_msg = mysql_result($result,0);
$total = intval(($c_msg - 1) / $num) + 1;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$q = mysql_query("SELECT * FROM gb ORDER BY id DESC LIMIT $start, $num");
$gb['answer'] = $answergb;
switch($_SERVER['QUERY_STRING']){
default:
if ($c_msg==0)
{
echo "<div class='p1'><span class='t1'>Сообщений нет...</span></div>";
}
else
{
while($gb = @mysql_fetch_array($q))
{
include "replace.php";
echo "<div class='p1'><span class='tm'>".$gb['date']."]</span><span class='t1'> ".$gb['name']."</span><br/><div class='t2'>
".$gb['msg']."<br/>";
if($gb['answer']!=""){echo "<u>Ответ:</u> ".$gb['answer']."\n";}
echo "</div></div>\n\n";
}}
///// navigation
echo "<div class='pg'>\n";
if ($page != $total) $nextpage = ' | <a href="index-'. ($page + 1) .'.xhtml">след»</a>
';
if($page - 2 > 0) $page2left = ' <a href="index-'. ($page - 2) .'.xhtml">'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = ' | <a href="index-'. ($page - 1) .'.xhtml">«пред</a> ';
if($page + 1 <= $total) $page1right = ' <a href="index-'. ($page + 1) .'.xhtml">'. ($page + 1) .'</a>';
if($total == "1"){ $xxx = '<small>Стр. '.$page.$page1left.$nextpage.'</small>'; }
else {$xxx = '<small>Стр. <a href="pages.xhtml">'.$page.' из '.$total.'</a>'.$page1left.$nextpage.'</small>'; }
echo $xxx;
echo '</div>';
echo '<div class="f1">
<a href="add.xhtml" class="l1">Добавить сообщение</a><br/><a href="/" class="l2">Главная</a><br/>
</div>';
///////////
break;
case 'auth':
echo "<div class='p1'><form name='auth' action='index.adm' method='get'>
<div class='t1'>Логин:</div>
<input class='itxt' name='login' type='text' size='20' maxlength='15'/><br/>
<div class='t1'>Пароль:</div>
<input class='itxt' name='pass' type='text' size='20' maxlength='500' /><br/>
<input type='submit' value='Войти' class='ibtn'/>
</form></div><div class='f1'><a href='index.xhtml' class='l2'>Гостевая</a><br/></div>";
break;
// Добавление сообщения
case 'add':
/*
$rand = rand(0000,9999);
mysql_query ("UPDATE gb_protect SET code='$rand' WHERE id='1'");
$c = mysql_query ("SELECT * FROM gb_protect WHERE id='1'");
$cc = mysql_fetch_array($c);
$protect = $cc['code'];
*/
echo "<div class='p1'><form name='formawin' action='add.msg' method='post'>
<div class='t1'>Ваше имя:</div>
<input class='itxt' name='name' type='text' size='20' maxlength='225' value='$name' /><br/>
<div class='t1'>Сообщение:</div>
<input class='itxt' name='msg' type='text' size='20' maxlength='500' /><br/>
<div class='t1'>Транслит:</div>
<select name='translite' class='itxt'><option value='0'>нет</option><option value='1'>да</option></select><br/>
<img src='gif.php' alt=''><br/>
<div class=t1>
Введите число, изображенное на любой картинке сверху:</div>
<input class='itxt' name='code' type='text' size='4' maxlength='4' /><br/>
<input type='submit' value='Сказать' class='ibtn'/>
</form></div>
<div class='f1'>
<a href='smiles.xhtml' class='l1'>Смайлы</a><br/>
<a href='index.xhtml' class='l2'>Гостевая</a><br/>
</div>";
break;
case 'pg':
echo "<div class='p1'>
<div class='t1'>
Внимание! Страницы здесь считаются начиная с нулевой.<br/>
</div>
</div>
<form name='formawin' action='index.xhtml' method='get'>
Перейти на страницу [$page2left$page из $total]
<input class='itxt' name='page' type='text' size='4' maxlength='4' value='0' /><br/>
<input type='submit' value='Перейти' class='ibtn'/><br/>
</form>
<small>
<div class=f1>
<a href='javascript:history.back(1)'>«Назад</a>
</div>
</small>";
break;
case 'smiles':
echo "<div class=f1>
Вы можете вставить только один смайл в сообщение набрав в угловых скобках число от 1 до 38</div>
<br/>
<img src='./s/1.gif' alt=':-)'/><1>
<img src='./s/2.gif' alt=':-('/><2> <br/>
<img src='./s/3.gif' alt=':-['/><3>
<img src='./s/4.gif' alt='8-)'/><4> <br/>
<img src='./s/5.gif' alt=':-E)'/><5>
<img src='./s/6.gif' alt=':-P'/><6> <br/>
<img src='./s/7.gif' alt='{beer}'/><7>
<img src='./s/8.gif' alt='{tee}'/><8> <br/>
<img src='./s/9.gif' alt='{smoke}'/><9>
<img src='./s/10.gif' alt='{vine}'/><10> <br/>
<img src='./s/11.gif' alt='{kiss}'/><11>
<img src='./s/12.gif' alt='{heard}'/><12> <br/>
<img src='./s/13.gif' alt=''/><13>
<img src='./s/14.gif' alt='{ok}'/><14> <br/>
<img src='./s/15.gif' alt='{no}'/><15>
<img src='./s/16.gif' alt='{cool}'/><16> <br/>
<img src='./s/17.gif' alt='{flower}'/><17>
<img src='./s/18.gif' alt='{cherry}'/><18> <br/>
<img src='./s/19.gif' alt='{ball}'/><19>
<img src='./s/20.gif' alt='{surprise}'/><20> <br/>
<img src='./s/21.gif' alt='{cake}'/><21>
<img src='./s/22.gif' alt='{phone}'/><22> <br/>
<img src='./s/23.gif' alt='{mobile}'/><23>
<img src='./s/24.gif' alt='{wall}'/><24> <br/>
<img src='./s/25.gif' alt='{camel}'/><25>
<img src='./s/26.gif' alt='{cat}'/><26> <br/>
<img src='./s/27.gif' alt='{pig}'/><27>
<img src='./s/28.gif' alt='{hammer}'/><28> <br/>
<img src='./s/29.gif' alt='{gun}'/><29>
<img src='./s/30.gif' alt='{skull}'/><30> <br/>
<img src='./s/31.gif' alt='{rip}'/><31>
<img src='./s/32.gif' alt='{sun}'/><32> <br/>
<img src='./s/33.gif' alt='{moon}'/><33>
<img src='./s/34.gif' alt='{lock}'/><34> <br/>
<img src='./s/35.gif' alt='{dollar}'/><35>
<img src='./s/36.gif' alt='{fig}'/><36> <br/>
<img src='./s/37.gif' alt='{drug}'/><37>
<img src='./s/38.gif' alt='{fuck}'/><38> <br/>
<div class=f1>
<a href='javascript:history.back(1)' class='l1'>Назад</a>
</div>";
break;
}
do_footer();
?>