<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/adm_check.php';
include_once '../sys/inc/user.php';
user_access('adm_mysql',null,'index.php?'.SID);
adm_check();
$set['title']='Голова бота';
include_once '../sys/inc/thead.php';
title();


echo "Всего приколов в базе: ".mysql_result(mysql_query("SELECT COUNT(*) FROM `bot_comedy`"),0)."<br />\n";

if (isset($_GET['del'])){



mysql_query("DELETE FROM `bot_comedy` WHERE `id` = '$_GET[del]'");


msg('Прикол успешно удалён');

}

if (isset($_GET['up_ok'])){

mysql_query("UPDATE `bot_comedy` SET `msg` = '$_POST[msg]' WHERE `id` = '$_GET[up_ok]' LIMIT 1");

msg('Прикол успешно изменён');
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `bot_comedy` "), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `bot_comedy` ORDER BY id DESC LIMIT $start, $set[p_str]");
if ($k_post==0)
{
echo "На данный момент бот не знает приколов\n";
}

//Автор скрипта PiloT


while ($mem = mysql_fetch_assoc($q))
{

echo "...$mem[msg]...<br />";
echo "<a href='?up=$mem[id]&amp;page=$page'><b>[изменить]</b> </a><br />\n";
echo "<a href='?del=$mem[id]&amp;page=$page'><b>[x]</b></a><br />\n";

if (isset($_GET['up']))
{
echo "<form action=\"?up_ok=$mem[id]&amp;page=$page\" method=\"post\">";



echo "Прикол:<br />\n";
echo "<input type='text' name='msg'
value='$mem[msg]' /><br />\n";


echo "<input value=\"Переучить бота\" type=\"submit\" />\n";
echo "</form>\n";
}
 echo "<center>= = = = = = = = =</center>";
} if ($k_page>1)str("?",$k_page,$page); // Вывод страниц

if (user_access('adm_panel_show')){
echo "<div class='foot'>\n";
echo "&laquo;<a href='/adm_panel/'>В админку</a><br />\n";
echo "</div>\n";
}
include_once '../sys/inc/tfoot.php';
?>