diff --git a/user/editfile.php b/user/editfile.php index 9d086af..208aed0 100644 --- a/user/editfile.php +++ b/user/editfile.php @@ -2,33 +2,22 @@ require ("../includes/content.php"); require ("../includes/miscfunc.php"); require ("../includes/htmlcode.php"); -$filename = $_GET['file']; -$file = Page::$parentDir . Page::$contentFolder . $filename; -$filehandle = fopen ("$file", "rw"); -$content = fread($filehandle, filesize($file)); +//Make some form of control below, this is unsafe... +$file = Page::$parentDir . Page::$contentFolder . $_GET['file']; +if(isset($_POST['content'])) +{ + $postedContent = $_POST['content']; + file_put_contents($file, $postedContent); +} start_html("Edit file"); -print "
-Text:
- -
- -
-"; +print "
\n"; +$content = file_get_contents($file); +print ""; +print "
\n + +
"; +end_html(); -if (!isset($_POST['post'])) -{ - end_html(); - die; -} - -if (fwrite($filehandle, $_POST['post']) === FALSE) -{ - echo "Cannot write to file ($file)"; - exit; -} - -echo "Success, saved file ($file)"; -fclose($filehandle); ?> diff --git a/user/updatefile.php b/user/updatefile.php deleted file mode 100644 index afd2c48..0000000 --- a/user/updatefile.php +++ /dev/null @@ -1,17 +0,0 @@ -