Размер файла: 3.17Kb
<?php
Defined('ADMIN_S_S') or die ('Доступ запрещен!!!');
echo
'<span class="ramka">
Редактировать статью.
</span><br>';
if ($_POST['step'] == 1 or $_POST['step'] == '')
{
$st_r = 10;
if (is_file('stat/base.txt')) $post = @file('stat/base.txt'); else echo 'Ошибка';
$count_post = count($post);
if (empty($_GET['pages'])) {
$pages = 1;
} else {
$pages = (int) $_GET['pages'];
}
$j = ($count_post-1)-(($pages-1)*$st_r);
$i = $j-$st_r;
for(; $i<$j && $j>=0; $j--)
{
$fn = explode("|",$post[$j]);
$mess1 = substr($fn[1],0,250);
include('flud/delet_bb.php');
$rec = $mess1;
echo '
<span class="mess1">'.$fn[0].'</span> <span class="mess2">'.$rec.'</span>
<form name="" action="" method="post">
<input name="line" type="hidden" value="'.$j.'">
<input name="step" type="hidden" value="2">
<input class="knopka" type="submit" value="Выбрать">
</form>
<hr>
';
}
echo 'Страницы: '."\n";
$all = ceil($count_post/$st_r);
for ($i=1;$i<=$all;$i++) {
if ($pages==$i) {
echo '<b>'.$i.'</b> ';
} else {
echo '<a href="/adminf.php?id='.trim($_GET['id']).'&pages='.$i.'">'.$i.'</a> '."";
}
}
}
elseif ($_POST['step'] == 2)
{
if (is_file('stat/base.txt')) $post = @file('stat/base.txt'); else echo 'Ошибка';
$ex = explode('|',$post[$_POST['line']]);
$ex[1] = str_replace('<br>',"\r\n",$ex[1]);
$mess1 = $ex[1];
include('flud/anti_y.php');
$ex[1] = $mess1;
?>
<span class="ramka">
<form name="" action="" method="post">
Заголовок:<br>
<input name="im_f" type="text" value="<?php echo $ex[0] ?>"><br>
Текст:<br>
<textarea style="width: 100%;" name="opis_f" rows=30 cols=50><?php echo $ex[1] ?></textarea>
<br>
<input name="step" type="hidden" value="3">
<input name="line" type="hidden" value="<?php echo $_POST['line'] ?>">
<input class="knopka" type="submit" value="Редактировать">
</form>
</span>
<?php
}
elseif ($_POST['step'] == 3)
{
if (($_POST['im_f'] != "") and ($_POST['opis_f'] != ""))
{
$fname = $_POST['fname'];
$n = htmlspecialchars (substr($_POST['im_f'],0,150));
$o = $_POST['opis_f'];
$mess1 = $o;
include('flud/anti_x.php'); //анти мат полный фильтр
$o = $mess1;
$n=strtr($n,array
(
"|"=>"I",
"\r\n"=>"<br>",
));
$line = $_POST['line'];// строка
$rep = $n.'|'.stripslashes($o).'|'.date("d/m/Y")."\r\n";
$file = @file('stat/base.txt');
$count = count($file);
$fp = fopen('stat/base.txt',"w");
for($i=0;$i<$count;$i++)
{
if($i!=$line)
{
fwrite($fp,stripslashes($file[$i]));
}
else
{
fwrite($fp,stripslashes($rep));
echo '
<span class="ramka">
Успешно!
</span>
<a href="/adminf.php?m='.$_GET['m'].'&id='.$_GET['id'].'">Далее</a>
';
}
}
fclose($fp);
}
else
{
echo 'Ошибка. Поля не заполнены полностью...';
}
}
?>