Файл: putevod/adm_panel/putevod/index.php
Строк: 81
<?
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_menu',null,'/adm_panel/index.php?'.SID);
adm_check();
$set['title']='Админка'; // заголовок страницы
include_once '../../sys/inc/thead.php';
title();
if (isset($_POST['edit']) && isset($user)) {
$id = intval($_GET['id']);
$url = my_esc($_POST['edit']);
$text = my_esc($_POST['text']);
$time = $_POST['time']*3600;
mysql_query("UPDATE `putevoditel` SET `str_url` = '".$url."', `help_text` = '".$text."', `time` = '".$time."' WHERE `id` = '$id' ");
msg("Измененно");
}
if (isset($_POST['url']) && isset($user))
{
$url =trim($_POST['url']);
$text =trim($_POST['text']);
$time = $_POST['time']*3600;
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `putevoditel` WHERE `str_url` = '".my_esc($url)."' LIMIT 1"),0)!=0){$err='Такой путь уже существует';}
elseif(!isset($err)){
mysql_query("INSERT INTO `putevoditel` (str_url, help_text, time) values('".my_esc($url)."', '".my_esc($text)."', '".$time."')");
msg('Успешно');
}
}
err();
aut(); // форма авторизации
if (isset($_GET['ed'])) {
$id_ed = intval($_GET['ed']);
$txt=mysql_fetch_assoc(mysql_query("SELECT * FROM `putevoditel` WHERE `id` = '".$id_ed."' "));
echo '<form action = "?id='.$id_ed.'" method=post>
Путь к странице:
<br />
<input name = edit value = "'.$txt['str_url'].'"><br />
Текст помощи:
<br />
<textarea name = "text">'.$txt['help_text'].'</textarea><br />
Время отображения в часах:
<br />
<input name = "time" value = "'.$txt['time'].'">
<br />
<input type = submit value = Изменить><br />';
include_once '../../sys/inc/tfoot.php';
exit;
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `putevoditel`"),0);
echo '<br /> Всего слов '.$k_post.'<br />';
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>n";
if ($k_post==0)
{
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Пустоn";
echo " </td>n";
echo " </tr>n";
}
echo "<form method="post" name='message' action="?$passgen">n";
echo "<br />Путь к странице:<br /> <input name="url"><br />n";
echo 'Текст помощи:<br /><textarea name = "text"></textarea><br />';
echo 'Время отображения в часах:
<br />
<input name = "time" value = "24">
<br />';
echo "<input value="Отправить" type="submit" />n";
echo "</form>n";
$txt_show=mysql_query("SELECT * FROM `putevoditel` ORDER BY id DESC LIMIT $start, 30");
while ($txt = mysql_fetch_assoc($txt_show)) {
echo "<div class = 'p_m'>";
echo $txt['str_url'].' <br />';
echo $txt['help_text'].' <br />';
echo "<a href='?ed=$txt[id]'>изм.</a> / <a href='delete.php?id=$txt[id]'>уд.</a><br />";
echo " </div>n";
echo " </tr>n";
}
echo "</table>n";
if ($k_page>1)str('index.php?',$k_page,$page); // Вывод страниц
echo "</div>n";
include_once '../../sys/inc/tfoot.php';
?>