Location: PHPKode > projects > DDL CMS > Upload these files to your webspace/admin/editpages.inc
<h2>Edit Pages</h2>
<p>
<?php
	if(isset($_GET) && count($_GET) > 0 && checkURLQuery('editpages.php', $_GET) === TRUE)
	{
		if(isset($_POST) && count($_POST) > 0)
		{
			if(isset($_POST) && count($_POST) > 0 && checkPostForm('editPage', $_POST, TRUE) === TRUE)
			{
				echo 'Page updated successfully.';
				file_put_contents(WWWROOT . 'edit/' . $_POST['pageFileName'], $_POST['pageData']);
			}
			else
			{
				echo 'Updating page failed.';
			}
		}
		else
		{
			$pageArray = scandir(WWWROOT . 'edit/');
			if(in_array($_GET['pageFilename'], $pageArray) === FALSE)
			{
				echo 'File not found.';
			}
			else
			{
?>
		<span>Currently editing page: <?php echo '/edit/' . $_GET['pageFilename']; ?></span>
		<br>
<?php
				$fileData = file_get_contents(WWWROOT . 'edit/' . $_GET['pageFilename']);
?>
	<form action="ddl.php?go=editpages&pageFilename=<?php echo $_GET['pageFilename']; ?>" method="post">
		<input type="hidden" name="pageFileName" value="<?php echo $_GET['pageFilename']; ?>" />
		<label for="txaPage">Page Contents:</label>
		<br />
		<textarea name="pageData" rows="30" cols="80" id="txaPage">
<?php
	echo $fileData;
?>
		</textarea>
		<br><br>
		<input type="submit" value="Edit Page" />
		<input type="reset" />
	</form>
<?php
			}
		}
	}
	else
	{
		echo '<ul>' . "\n";
		$pageArray = scandir(WWWROOT . 'edit/');
		for($i = 3; $i < count($pageArray); $i++)
		{
			echo "<li><a href=\"ddl.php?go=editpages&pageFilename={$pageArray[$i]}\">{$pageArray[$i]}</a></li>";
		}
		echo '</ul>' . "\n";
	}
?>
Return current item: DDL CMS