<?php
include("db.php");
//variabelen declareren
$id=$_GET["id"];
$sql = "SELECT * FROM contents where id='".$_GET["id"]."'";
$result = mysql_query($sql) or die("Query failed : " . mysql_error());
$row = mysql_fetch_assoc($result);
$content = $row['content'];
$title = $row['title'];
//controleren of de gebruiker is ingelogd
session_start();
if(session_is_registered("myusername")){
$aanpassen = "<a href='index.php?id=$id&a=edit'>Aanpassen</a>";
//selecteer pagina menu
echo "<input name='title' type='text' size='15' value='".$title."'>";
echo "<select class='formStyle' name='nparent'>";
echo "<option label='root' value='0'>root</option>";
GetParentMenu($_GET["id"]);
echo "</select>";
}else{
$aanpassen = "";
}
//inhoud tabel maken
echo "<table align='center' border='0'>
<tr>
<th>Inhoud</th>
</tr>";
echo "<tr>";
echo "<td>" . $content . "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='right'>" . $aanpassen . "</td>";
echo "</tr>";
echo "</table>";
//fckeditor aanroepen/maken
if (isset($_GET["a"])){
if ($_GET["a"] == "edit"){
include_once("fckeditor/fckeditor.php");
echo "<form method='POST' action='" . $_SERVER['PHP_SELF'] . "'>";
$oFCKeditor = new FCKeditor("fckeditor1") ;
$oFCKeditor->BasePath = 'fckeditor/' ;
$oFCKeditor->Value = $content;
$oFCKeditor->Create() ;
echo "<input type='submit' value='submit'>";
//post omzetten naar variabelen
if ( isset( $_POST ) )
$postArray = &$_POST ; // 4.1.0 or later, use $_POST
foreach ( $postArray as $sForm => $value )
{
}
//updatequery
echo $query = "UPDATE contents SET content = ".$_POST['fckeditor1']." where id = ".$id;
$result = mysql_query($query);
}
}
?>