View file admin/code.php

File size: 0.98Kb
<?php
$title = 'Редактор кода';
include_once($_SERVER["DOCUMENT_ROOT"]."/inc/head.php");
if ($adm_id == 1) {
    echo '<div class="title">Редактор кода</div>';
    $filename = $_SERVER["DOCUMENT_ROOT"]."/inc/foot.php";
    $contents = contentFileNow($filename);
    if (isset($_POST['submit'])) {
        $text = $_REQUEST['code'];
        editFileNow($filename, $text);
        echo '<div class="menu">Файл успешно отредактирован!</div>';
        header('Refresh: 1');
    } else {
        echo '<div class="menu"><form action="" method="post">Файл inc/foot.php:<br/><textarea rows="5" cols="30" name="code">'.$contents.'</textarea><br/><input type="submit" name="submit" value="Сохранить"></form></div>';
    }
    if ($version == 'mobile') echo '<div class="forlink"><a href="/adm" class="links">Панель управления</a></div>';
} else {
    header ('location: /');
} 
include_once($_SERVER["DOCUMENT_ROOT"]."/inc/foot.php");
?>