\n"; echo " \n"; if ($_POST['action'] == 'write') { // Write to file goes here if (!file_exists($file)) { // Shouldn't ever happen echo 'zomg, 404!'; exit; } $flink = fopen($file, 'w'); $ftxt = fwrite($flink, $text = stripslashes($_POST['text'])).' bytes written.'; fclose($flink); $before = array('', '&'); $after = array('</textarea>','&'); $text = str_replace($before, $after, $ftxt); echo " $b\n"; echo ""; } else if ($_POST['action'] == 'open') { // Read from file goes here if (!file_exists($file)) { echo 'zomg, 404!'; exit; } $flink = fopen($file, 'r'); $ftxt = fread($flink, filesize($file)); fclose($flink); $before = array('', '&'); $after = array('</textarea>','&'); $ftxt = str_replace($before, $after, $ftxt); echo "
\n"; // Doesn't handle tags well echo "
\n"; } } else { // Select file goes here ?>