View file adm/red_menu.php

File size: 967B
<?php
echo
'<span class="ramka">
Редактировать меню.
</span><br>';

if ($_POST['pokas'] != 1)
{
$fp = fopen ('menu/menu.txt', "r");
$buffer = fread($fp, filesize('menu/menu.txt'));
fclose ($fp);
$buffer = str_replace('<!--//line//-->',"\r\n",$buffer);
echo
'
<form name="" action="" method="post">
<textarea name="menu" rows=15 style="width: 98%;">'.$buffer.'</textarea>
<input name="pokas" type="hidden" value="1">
<br>
<input class="knopka" type="submit" value="Изменить">
</form>
';
}
else
{
 $buffer = $_POST['menu'];
 $buffer = str_replace('\"','"',$buffer);
 $buffer = str_replace('\'','"',$buffer);
 $buffer = str_replace("\r\n",'<!--//line//-->',$buffer);
 $fp = fopen ('menu/menu.txt', "w+");
 fwrite ($fp, stripslashes($buffer));
 fclose ($fp);
 echo '
   <span class="ramka">
   Успешно!
   </span>
   <a href="/adminf.php?m='.$_GET['m'].'&id='.$_GET['id'].'">Далее</a>
   ';
}


?>