puoi creare una textarea cosìvedi tutto il file txt come se fosse sul tuo pc e puoi cancellare e riscrivere quando vuoi, x es. così
Codice PHP:
[FONT=courier new]<?PHP
// -----------// START PHP TEXT // ----------- //
$path = 'file_di_testo.txt';
function fileArray($file){
if( is_string($file) and file_exists($file) ):
$file = file($file);
settype($valori,'string');
$righe = count($file);
foreach($file as $key => $val):
$valori .= $val ;
endforeach;
return $modulo = <<< FORM
<form method="post" action="">
<textarea name="db" rows="{$righe}" cols="20">
{$valori}
</textarea>
<input type="submit" />
</form>
FORM;
else:
return null;
endif;
}
if(isSet($_REQUEST['db'])){
if( is_writeable($path) ):
if( fwrite( fopen($path,'w') , $_REQUEST['db'] ) ){
die( 'scrittura sul file eseguita' );
} else {
die( 'scrittura sul file non eseguita' );
}
else: echo 'file non scrivibile';
endif;
}
else {
$file = fileArray($path);
if($file){
echo $file;
} else {
echo 'non hai specificato un percorso del db corretto' ;
}
}
// -----------// END PHP TEXT // ----------- //
?>[/FONT]
ah ricordati di settare il CHMOD 777 al file di testo