Deleted obsolete file updatefile.php and rewrote editfile.php completly
This commit is contained in:
parent
b9cbc947b5
commit
56da0c396a
@ -2,33 +2,22 @@
|
|||||||
require ("../includes/content.php");
|
require ("../includes/content.php");
|
||||||
require ("../includes/miscfunc.php");
|
require ("../includes/miscfunc.php");
|
||||||
require ("../includes/htmlcode.php");
|
require ("../includes/htmlcode.php");
|
||||||
$filename = $_GET['file'];
|
|
||||||
$file = Page::$parentDir . Page::$contentFolder . $filename;
|
|
||||||
|
|
||||||
$filehandle = fopen ("$file", "rw");
|
//Make some form of control below, this is unsafe...
|
||||||
$content = fread($filehandle, filesize($file));
|
$file = Page::$parentDir . Page::$contentFolder . $_GET['file'];
|
||||||
|
|
||||||
|
if(isset($_POST['content']))
|
||||||
|
{
|
||||||
|
$postedContent = $_POST['content'];
|
||||||
|
file_put_contents($file, $postedContent);
|
||||||
|
}
|
||||||
start_html("Edit file");
|
start_html("Edit file");
|
||||||
print "<form action=\"$_SERVER[PHP_SELF]\" method='post'>
|
print "<form action=\"\" method=\"post\">\n";
|
||||||
Text: <br />
|
$content = file_get_contents($file);
|
||||||
<textarea cols='80' rows='30' name='file'>$content</textarea>
|
print "<textarea name='content' cols='80' rows='30'>\n" . ($content) . "\n</textarea>";
|
||||||
<br />
|
print "<br/>\n
|
||||||
<input type='submit' value='Save file'>
|
<input type=\"submit\" value=\"Save file\"/>
|
||||||
</form>
|
</form>";
|
||||||
";
|
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);
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
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);
|
|
||||||
|
|
||||||
?>
|
|
Loading…
x
Reference in New Issue
Block a user