Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @autor: YO xDDDDD
- * Uso: se pasan los parametros por url accion y archivo asi:
- *
- * action=edit&archivo=/ruta/hacia/el/archivo.ext
- *
- * NOTA: Se debe tener en cuenta que el archivo debe tener permisos de escritura
- */
- if ((isset($_POST['btn_func']) && $_POST['btn_func'] == "Guardar") && (isset($_POST['multilinea']) && $_POST['multilinea'] != "") && (isset($_POST['ruta']) && $_POST['ruta'] != "")) {
- $guardar_arc = fopen($_POST['ruta'], 'w');
- if (fwrite($guardar_arc, $_POST['multilinea'])) {
- echo "<span style='color: #0F0;'>Archivo guardado!!!</span>";
- } else {
- echo "<span style='color: #F00;'>No se pudo guardar!!!</span>";
- }
- }
- ?>
- <form action = "<?php echo $_SERVER['SCRIPT_NAME']; ?>" method = "post">
- <textarea id = "multilinea" name = "multilinea" style = "width: 95%; height: 150px; resize: none;"><?php
- if (isset($_GET['archivo'], $_GET['action']) && ($_GET['archivo'] != "" && $_GET['action'] == "edit")) {
- $archivo = file_get_contents($_GET['archivo']);
- $archivo = ucfirst($archivo);
- echo htmlentities($archivo);
- }
- ?></textarea>
- <br><input type="text" name="ruta" value="<?php
- if (isset($_GET['archivo']) && $_GET['archivo'] != '') {
- echo $_GET['archivo'];
- }
- ?>" style="width: 50%;"> <input type="submit" name="btn_func" id="btn_save" value="Guardar">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment