I have this simple web content editor written in php
[code]<?php
if (isset($_POST['home']))
{
if (file_put_contents('homecontent.txt', $_POST['homecontent']) !== FALSE) echo '<p class="success">Home Content Saved Successfully!</p>', "\n";
}
$homecontent = file_get_contents('homecontent.txt');
if (isset($_POST['header']))
{
if (file_put_contents('headercontent.txt', $_POST['headercontent']) !== FALSE) echo '<p class="success">Header Content Saved Successfully!</p>', "\n";
}
$headercontent = file_get_contents('headercontent.txt');
if (isset($_POST['cssfile']))
{
if (file_put_contents('style.txt', $_POST['cssfile']) !== FALSE) echo '<p class="success">Style.css Saved Successfully!</p>', "\n";
}
$cssfile = file_get_contents('style.txt');
?>
Here you can edit your homepage text:
<?php echo $homecontent ?>Save changes
Here you can edit your header content:
<?php echo $headercontent ?>Save changes
Here you can edit style.css file:
<?php echo $cssfile ?>Save changes
The problem in this script is that it execute first 2 forms, but the last 1 fails. However, it creates the 3rd file when executed for the first time. If I add new content it gets erased after submit. It cannot be a server specific becasue I tested it on 3 different server. Error log is not recording anything because I get success message.
