Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/10/2006, 01:46
Avatar de urgido
urgido
 
Fecha de Ingreso: febrero-2005
Mensajes: 2.351
Antigüedad: 19 años, 2 meses
Puntos: 25
guardalo como: funciones.php
Código PHP:
<?php
if(isset($_POST["submit"])){
if(@
$fp fopen("archivo.txt""w")){
  
fwrite($fpstripslashes($newdata));
  
fclose($fp);
} else {
  exit (
"<h1>Error</h1>\n<p>No se puede escribir el archivo, asegurate que los permisos son correctos(CHMOD 777).</p>");
}
}

if(
$fp fopen("archivo.txt""r")){
  
$data fread($fpfilesize("archivo.txt"));
  
fclose($fp);
} else {
  
$data "";
  exit (
"<h1>Error</h1>\n<p>No se puede escribir el archivo, asegurate que los permisos son correctos(CHMOD 777).</p>");
}
?>
guardalo como: upload.php
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Editar TXT</title>
</head>
<body>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<fieldset>
  <legend>Editar "archivo.txt"</legend>
  <label>Contenido <strong>Archivo.txt</strong>:<br><textarea name="newdata" rows="50" cols="100"><?php
   echo $data;
  ?></textarea></label><br>
  <label><input type="submit" name="submit" value="Guardar"></label>
</fieldset>
</form>
</body>
</html> 
__________________
Hospedaje Web al mejor costo!