You could always do something like this which gives you feedback 😉
<?php
$file_loc = 'ddrfreek.css';
// No matter what, we want the contents of the text file:
$contents = trim(file_get_contents($file_loc));
if(isset($_POST['update'])) {
if($_POST['update'] != $contents) {
$fh = @fopen($file_loc, 'w');
if(!$fh) $msg = '0Unable to open file for updating.';
if(fwrite($fh, $_POST['update']) !== false) {
$msg = '1The file has been successfully updated.';
$contents = $_POST['update'];
}
if($fh)
fclose($fh);
}
else
$msg = '2The submitted contents were the same as the current file contents. No update necessary.';
}
else
$msg = '';
$lvl = substr($msg, 0, 1);
/*.................... RED ............ GREEN ... BLUE ....*/
$bgcolor = ($lvl==0?'EE3B3B':($lvl==1?'7BCC70':'B0C4DE'));
$txtcolor = '000'; //($lvl==0 ?'000':($lvl==1?'000':'000'));
$msg = substr($msg, 1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Stylesheet Editor</title>
<script language="javascript" type="text/javascript">
function opacity(id, opacStart, opacEnd, millisec) {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
} else if(opacStart < opacEnd) {
for(i = opacStart; i <= opacEnd; i++)
{
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
}
}
function changeOpac(opacity, id) {
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
}
window.onload = function () {
opacity('message', 100, 0, 5000);
};
</script>
</head>
<body>
<?php
if(!empty($msg))
echo '<div id="message" style="width: 450px; border: 2px groove #000; background-color: #'.$bgcolor.'; color: '.$txtcolor.'">'.$msg.'</div>';
?>
<form name="form1" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<textarea name="update" cols="60" rows="30"><?php echo $contents; ?></textarea>
<input type="submit" type="submit" value="Update" />
</form>
</body>
</html>