I'm trying to use CKEditor to allow editing of a HTML file on my server. Below is the code I'm using. My thoughts with the PHP include function inside the CKEditor Textarea was that the user would be able to see what they are editing - therefore this would probably have to be set to an overwrite?
(Note: I have set the read/write permissions to the file on the server to 666)
<?php
$action = $_GET["action"];
$editor = $_POST["editor1"];
if($action = "save") {
$targetFolder = "/folder";
file_put_contents($targetFolder."file.html", $editor1);
}
?>
<form action="?action=save" name="myform" method="post" >
<textarea name="editor1" id="editor1" rows="20" cols="160">
<?php include($_SERVER['DOCUMENT_ROOT']. "/folder/file.html"); ?>
</textarea>
<script>
CKEDITOR.replace( 'editor1' );
</script>
<input type="submit" value="save">
</form>
Help would be very much appreciated. Thankyou.