Now we finally have everything we need to write a new file:
(as the current mainstream development language)
// Open the file , and truncate the file length to 0
$open_file = fopen("messages.html", "w");
// Write the header information of the file
fputs($open_file, $ header);
// new line
// (use stripSlashes because we don’t want all the escape characters to appear in the message file)
fputs($open_file, stripslashes($new_message ));
// Old lines
fputs($open_file, $old_messages);
// Footer
fputs($open_file, $footer);
//Close the file
fclose($open_file);
?>