File size: 5.43Kb
<?php
include_once "../config.php";
include_once "../inc/inc.php";
include_once "../inc/func.php";
include_once "../inc/user.php";
include_once "../inc/gzip.php";
include_once "../inc/online.php";
include_once "../themes/$theme/index.php";
if ($dostup != '1') {
echo "ПАШШШШШШШОЛНАХУЙ";
include_once "../themes/$theme/foot.php";
exit;
} else {
if (!isset($act)) {
if ($kto == 'user') {
echo 'Управление новостями<br>';
echo'<form action="addnews.php?act=add" method="post">';
echo'Сообщение<br>';
echo'<textarea cols="30" rows="5" name="msg" type="text" value=""></textarea><br><br>';
echo'<input type="submit" value="Добавить новость">';
echo'</form><hr>';
} else {
echo 'Вы не можете добавлять новости<hr>';
}
$vsego = mysql_num_rows(mysql_query("SELECT * FROM " . $pref . "news"));
$pagevsego = $vsego / $kolnews;
$pagevsego = (int)$pagevsego;
$bbb = $vsego - ($pagevsego * $kolnews);
if ($bbb > 0) {
$pagevsego++;
}
$page = (int)$page;
if ($page >= $pagevsego) {
$page = $pagevsego;
}
if ((!isset($page)) || ($page <= 0) || ($page == '')) {
$page = 1;
$start = 0;
} else {
$start = ($page * $kolnews) - $kolnews;
}
$query = "SELECT * FROM " . $pref . "news ORDER BY id DESC LIMIT $start, $kolnews";
$result = mysql_query($query);
// echo $start;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="b">[' . $line['data'] . '] [' . $line['vrem'] . '] <a href="news.php?act=edit&idmsg=' . $line['id'] . '">[edit]</a>|<a href="news.php?act=del&idmsg=' . $line['id'] . '">[del]</a></div>';
$soob = smile($line['msg']);
echo $soob . '<br>';
// if (strlen($line['otvet'])>=2){echo'<font color="red">Ответ администрации:<br>'.$line['otvet'].'</font><br>';}
echo '[Разместил - ' . $line['login'] . ']<br>';
// if (strlen($line['otvet'])>=2){echo'<font color="red"><u>Ответ администрации:</u></font><br><font color="#aa0000">'.$line['otvet'].'</font><br>';}
}
echo '<hr>Страницы:<br>';
if ($page == '1') {
echo'<-Назад';
} else {
$ggg = $page-1;
echo '<a href="news.php?page=' . $ggg . '"><-Назад</a>';
}
echo ' [' . $page . ' из ' . $pagevsego . '] ';
if (($page == $pagevsego) || ($pagevsego == 0)) {
echo 'Вперёд-><br>';
} else {
$ggg = $page + 1;
echo '<a href="news.php?page=' . $ggg . '">Вперёд-></a><br>';
}
echo '<form action="news.php" method="get">';
echo '<input name="page" type="text" value=""><input type="submit" value=">>">';
echo '</form>';
echo '<hr>Всего новостей: ' . $vsego . '<br>';
echo '<a href="delnews.php?act=all">Удалить все новости</a>';
}
if ($act == 'edit') {
$idmsg = (int)$idmsg;
if ($idmsg == 0) {
echo'ПАШШШШШШШШШШШОЛ НАХХУЙ';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT * FROM " . $pref . "news WHERE id=" . $idmsg;
$result = mysql_query($query);
$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo'Редактируется новость юзера: <font color="red">' . $line['login'] . '</font><hr>';
echo'<form name="" action="editnews.php?idmsg=' . $idmsg . '" method="post">';
echo 'Дата:<br>';
echo '<input name="data" type="text" value="' . $line['data'] . '"><br>';
echo 'Время:<br>';
echo '<input name="vrem" type="text" value="' . $line['vrem'] . '"><br>';
echo'Сообщение:<br>';
echo'<textarea cols="30" rows="5" name="soob" type="text" value="">' . $line['msg'] . '</textarea><br><br>';
// echo'<input name="soob" type="text" value="'.$line['msg'].'"><br>';
// echo'Ответ администрации:<br>';
// echo'<textarea cols="30" rows="5" name="otv" type="text" value="">'.$line['otvet'].'</textarea><br><br>';
// echo'<input name="otv" type="text" value="'.$line['otvet'].'"><br><br>';
echo'<input type="submit" value="Сохранить">';
echo'</form>';
}
if ($act == 'del') {
$idmsg = (int)$idmsg;
if ($idmsg == 0) {
echo'ПАШШШШШШШШШШШОЛ НАХХУЙ';
include_once "../themes/$theme/foot.php";
exit;
}
$query = "SELECT * FROM " . $pref . "news WHERE id=" . $idmsg;
$result = mysql_query($query);
$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo'Удалить новость юзера <font color="red">' . $line['login'] . '</font>?<hr>';
echo $line['msg'] . '<br>';
echo'[<a href="news.php">НЕТ</a>] [<a href="delnews.php?idmsg=' . $idmsg . '">Да</a>]';
}
echo '<br><a href="index.php">Админка</a>';
}
include_once "../themes/$theme/foot.php";
?>