<?
// in te vullen data
$bestand = "bestand_te_editten.txt";
// do not touch, yes ?
if(is_readable($bestand) == FALSE)
{
die("Kon bestand niet openen: bestand is niet leesbaar");
}
if(is_writable($bestand) == FALSE)
{
die("Kon bestand niet openen: bestand is niet schrijfbaar");
}
if(isset($HTTP_POST_VARS["inhoud"]) == TRUE)
{
$inhoud = $HTTP_POST_VARS["inhoud"];
$handeling = fopen($bestand,"w") or die("Kon bestand niet openen om te schrijven");
$schrijf = fwrite($handeling,stripslashes($inhoud)) or die("Kon niet naar bestand schrijven");
echo "<b>Het bestand is succesvol bewerkt.</b><br><br>Klik <a href=\"javascript:history.back(-1)\">hier</a> om terug te gaan.";
die();
}
$inhoud = file_get_contents($bestand) or die("Kon bestand niet openen om uit te lezen");
?>
<html>
<head>
<title>Bestand editten</title>
</head>
<body bgcolor="#ffffff">
<form action="<? echo $HTTP_SERVER_VARS["PHP_SELF"]; ?>" method="post">
<textarea name="inhoud" cols="60" rows="20"><? echo $inhoud; ?></textarea><br>
<input type="submit" value="Wijzig !"> <input type="reset" value="Opnieuw">
</form>
</body>
</html>