Example #1
0
    ?>
    <form method="post" action="">
        <table>
            <tr>
                <td>
                    <textarea name="edit_text" cols="30" rows="10"><?php 
    echo $text;
    ?>
</textarea>
                    <input type="hidden" name="edit_file" value="files/<?php 
    echo $fileName;
    ?>
">
                </td>
            </tr>
            <tr>
                <td><input type="submit" value="Сохранить"></td>
            </tr>
        </table>
        <p><a href="file-list.php">Вернуться к списку</a></p>
    </form>
<?php 
} else {
    ?>
    <p><a href="?add">Добавить файл</a></p>
    <?php 
    filesList("files/", array('.', '..'));
}
?>
</body>
</html>
Example #2
0
<?php

function filesList($dir)
{
    $list = scandir($dir);
    echo '<ul>';
    foreach ($list as $fileName) {
        echo "<li>{$fileName}</li>";
    }
    echo '</ul>';
}
filesList($_GET['str']);