Created
June 20, 2012 19:19
-
-
Save mattdodge/2961671 to your computer and use it in GitHub Desktop.
Simple PHP File Editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$the_file = "file.txt"; | |
if (isset($_POST['content'])) { | |
$content = stripslashes($_POST['content']); | |
$fp = fopen($the_file,"w") or die ("Error opening file in write mode!"); | |
fputs($fp,$content); | |
fclose($fp) or die ("Error closing file!"); | |
} | |
?> | |
<form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post"> | |
<textarea rows="45" cols="80" name="content"><?php readfile($the_file); ?></textarea> | |
<input type="submit" value="Save"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment