
Chroelle wrote:Any idea if I might be able to use that, and then when I embed it in his newspage - will it be editable then???

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
$file = "news.txt";
$handle = fopen($file,"r");
$content = nl2br(fread($handle,filesize($file))); # nl2br, the minimal text processing.
fclose($handle);
?>
<h1>Front page</h1>
Hello!
<h2>News</h2>
<?=$content?>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
$file = "news.txt";
if ($_POST["submit"]=="submit") {
echo "Saving changes...";
$content = stripslashes($_POST["text"]); # Surftown has magic_quotes_gpc on.
$handle = fopen($file,"w");
if (!fwrite($handle,$content)) {
echo "Error writing to file.<br>";
} else {
echo "ok<br>";
}
fclose($handle);
} else {
$handle = fopen($file,"r");
$content = fread($handle,filesize($file));
fclose($handle);
}
?>
<h1>Edit stuff</h1>
<form action="admin.php" method="post">
<textarea name="text" rows="25" cols="80">
<?=$content?>
</textarea><br>
<button name="submit" type="submit" value="submit">Submit</button>
<button name="reset" type="reset">Reset</button>
</form>
</body>
</html>
admin:$apr1$ug0L8...$EPmcRCHiwb8WV20WSrdif1
AuthType Basic
AuthName "Admin Site"
AuthUserFile /hsphere/local/home/chroelle/domain.dk/.htpasswd
<Files admin.php>
Require user admin
</Files>


Chroelle wrote:How do I make sure. Just making news.txt writable to user, group etc or...?

Chroelle wrote:How about executable by all?
I checked and everything was made readable and writable, and I still can't make any changes that lasts longer than when I press submit... Can it be browser-related? I am using IE8... (Just checked and it works with Firefox...)
Ok, so back to the drawingboard. Why doesn't this work with IE8? (There is no way I can make this customer change to Firefox. He is propably surfing the internet with Netscape or something even older...)

if ($_POST["submit"] && strtolower($_POST["submit"])=="submit") {
Users browsing this forum: No registered users and 1 guest