Вход Регистрация
Файл: guest/index.php
Строк: 38
<?
require'../config.php';
$align='left';
$title='гостевая';
aut();
head();
if (
$user['id']){




$n check(intval($_GET['n']));
if (
$n>0){
if (
$user[level]>=9){
if (
DB::run()->query("DELETE FROM `books` WHERE `id` = ?",array(intval($n)))){header ('Location: index'); exit;
}else echo 
'Ошибка!<br />';
}
}
if (isset(
$_POST['msg'])){
if (
strlen2($_POST['msg'])>2){
$otv check($_POST['msg']);
$otv substr($otv,0,2000);
if (
DB::run()->query ("INSERT INTO books (kto,time,msg) VALUES (?,?,?)",array($user['id'],$time,$otv))){header ('Location: index'); exit;
}else echo 
'Ошибка!<br />'.div;
}else echo 
'Ошибка! короткое! не менее 3х символов<br />'.div;
}
echo 
'<form action="?mod=skaz" method="post">';
echo 
'<br />сообщение:<br /><textarea cols="'.$user['pole2'].'" rows="'.$user['pole1'].'" name="msg"></textarea><br/>';
echo 
'<input type="submit" class="ibutton" value="Добавить"/></form><br/>'.div;

if (empty(
$user['max'])) $user['max']=10;
$max $user['max'];
$k_post=DB::run()->querySingle("select count(*) as num from books");
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
$r DB::run()->query ("Select * from books order by time desc LIMIT $start$max");
if (
$k_post == 0)echo 'Сообщений нет'.div;
$post_k=$start+1;
while(
$a $r->fetch()){
if (
$user[id]==$a[kto]){
if (
$user[level]>=9){
echo 
links.''.nik($a[kto]).' ('.times($a['time']).') <a href="?n='.$a[id].'">[x]</a>'.div;
}else{
echo 
links.''.nik($a[kto]).' ('.times($a['time']).')'.div;
}
}else{
if (
$user[level]>=9){
echo 
links.''.nik($a[kto]).' ('.times($a['time']).') <a href="?mod=otv&nk='.$a[kto].'">[отв]</a> <a href="?n='.$a[id].'">[x]</a>'.div;
}else{
echo 
links.''.nik($a[kto]).' ('.times($a['time']).') <a href="?mod=otv&nk='.$a[kto].'">[отв]</a>'.div;
}
}
echo 
'<b>'.$a[komu].'</b> '.text($a[msg]).''.div;
}
if (
$k_page>1){
str('?',$k_page,$page); // Вывод страниц
}
echo 
gb.'<a href="../index">Главная</a>'.div;
}
foot();

?>
Онлайн: 0
Реклама