<?php/** * Simple PHP notepad that's editable by anyone * * @author d_sign * @copyright myself, 2008 */#filename you want to store notes in$filename = "notes.txt";#so now let's open it$file = fopen($filename, "r+");/*All right, if someone posted the form, then let's go on with the writing.*/if ($_POST) { ftruncate($file,0); #write the in the following format: TIME|:TEXT #also replaces any html with appropriate stuff. fwrite($file, time() . '|:)' . str_replace('<','<',str_replace('>','>',$_POST['text']))); #javascript redirect echo '<script type="text/javascript"> <!-- window.location = "' . $_SERVER['PHP_SELF'] . '" //--> </script>';}#close filefclose($file);#now get the contents so we can write it.$text = file_get_contents($filename);$stuff = explode('|:)',$text);$time = $stuff[0];$text = $stuff[1];#Shows things like forms, last updated, etc.echo 'Last updated: ' . date("M j, g:i A",$time) . '<br /> <form method="post" action="' . $_SERVER['PHP_SELF'] . '"> <textarea rows="18" cols="80" name="text">' . $text . '</textarea><br /><br /> <input type="submit" value="Edit" /> </form>';?>