<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>PHP + TXT</title> <link rel="shortcut icon" type="image/x-icon" href=""> <link title="defaut" type="text/css" rel="stylesheet" href="style.css" media="screen"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="keywords" content="MOT CLE1; MOT CLE2"> <meta name="Description" content="DESCRIPTION COURTE"> </head> <center>Récupération d'un texte dans un *.txt </center> <?php $chemin = 'texte.txt'; if(file_exists($chemin) && $lignes=file($chemin)){ foreach ($lignes as $ligne){ echo ''.$ligne.' '; } }else{ $handle = fopen($chemin,'w+'); fclose($handle); } ?> <center>Modification d'un texte dans un .txt </center> <?php $fname = "texte.txt"; if(!isset($_POST["text"])) { echo '<form method="post" action="">'; echo '<textarea name="text\' id="message" cols="80" rows="10">'; readfile($fname); echo '</textarea>'; echo ' '; echo '</form>'; } else { $fhandle = fopen($fname,"w"); $text = $_POST['text']; $text=strip_tags($text); /*si tu veux pas de tags*/ /*htmlentities ...*/ $text=stripslashes($text); fwrite($fhandle,$text); fclose($fhandle); echo '<center>Message modifié avec succés</center>'; echo '<center>[ Retour] </center>'; } ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>PHP + TXT</title> <link rel="shortcut icon" type="image/x-icon" href=""> <link title="defaut" type="text/css" rel="stylesheet" href="style.css" media="screen"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="keywords" content="MOT CLE1; MOT CLE2"> <meta name="Description" content="DESCRIPTION COURTE"> </head> <center>Récupération d'un texte dans un *.txt </center> <?php $chemin = 'texte.txt'; if(file_exists($chemin) && $lignes=file($chemin)){ foreach ($lignes as $ligne){ echo ''.$ligne.' '; } }else{ $handle = fopen($chemin,'w+'); fclose($handle); } ?> <center>Modification d'un texte dans un .txt </center> <?php $fname = "texte.txt"; if(!isset($_POST["text"])) { echo '<form method="post" action="">'; echo '<textarea name="text" id="message" cols="80" rows="10">'; readfile($fname); echo '</textarea>'; echo ' '; echo '</form>'; } else { $fhandle = fopen($fname,"w"); $text = $_POST['text']; //$text=strip_tags($text); /*si tu veux pas de tags*/ /*htmlentities ...*/ $text=stripslashes($text); fwrite($fhandle,$text); fclose($fhandle); echo '<center>Message modifié avec succés</center>'; echo '<center>[ Retour] </center>'; } ?> </html>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question