Her er scriptet så!
Lav en fil med navnet news.txt og CHMOD det til 777.
<?
// Nyheds-script
// Find more at
http://www.cht.dk/?>
<?
$titel = "Nyheder";
$fil = "news.txt";
?>
<?
$dato=date("d. M Y ",time());
?>
<? if ($action == "save") { ?>
<?
function save($file, $str) {
$fp = fopen($file, r);
if ($fp) {
$fileArray = file($file);
$result = implode("", $fileArray);
$result = "$str$result";
fclose($fp);
}
$fp = fopen($file, w);
if ($fp) {
fputs($fp, $result);
fclose($fp);
}
}
$file = "$fil";
$str = "<div align=\"center\"><center>
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"43%\">
<tr>
<td width=\"100%\" bgcolor=\"#808080\" colspan=\"2\"><div align=\"center\"><center><table
border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tr>
<td width=\"100%\" colspan=\"2\"></td>
</tr>
<tr>
<td width=\"1%\"></td>
<td width=\"97%\"><small><font face=\"Arial\"><strong><a href=\"mailto:$email\">$navn</a></strong></font></small></td>
</tr>
<tr>
<td width=\"100%\" colspan=\"2\"><div align=\"center\"><center><table border=\"0\" cellpadding=\"0\"
cellspacing=\"0\" width=\"100%\">
<tr>
<td width=\"1%\"></td>
<td width=\"97%\"><small><font face=\"Arial\"><big>$over</big></font></small></td>
</tr>
<tr>
<td width=\"100%\" colspan=\"2\"></td>
</tr>
</table>
</center></div></td>
</tr>
</table>
</center></div></td>
</tr>
<tr>
<td width=\"1%\"> <p> </td>
<td width=\"97%\" valign=\"top\"><hr size=\"0\">
<div align=\"center\"><center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"
height=\"42\">
<tr>
<td width=\"100%\" height=\"21\"><small><small><font face=\"Arial\">$dato</font></small></small></td>
</tr>
<tr>
<td width=\"100%\" height=\"21\">$besked</td>
</tr>
</table>
</center></div></td>
</tr>
</table>
</center></div><div align=\"center\"><center>
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"43%\">
<tr>
<td width=\"100%\"><hr>
</td>
</tr>
</table>
</center></div>\n";
save($file, $str);
?>
<html>
<head>
<title><? print $titel ?></title>
</head>
<body>
<hr>
<p align="center"><font face="Arial">Nyheden er tilføjet!</font></p>
<hr>
</body>
<html>
<?
}
else if ($action == "view") { ?>
<? include("$fil") ?>
<?
}
else { ?>
<?
}
if ($action == "write") { ?>
<html>
<head>
<title><? print $titel ?></title>
</head>
<body>
<p><strong><big><font face="Arial">Opret nyhed...</font></big></strong></p>
<hr>
<form method="POST" action="?action=save">
<p><small><font face="Arial">Dit navn: </font></small><input type="text" name="navn" size="20"></p>
<p><small><font face="Arial">Din e-mail: </font></small><input type="text" name="email" size="20"><p>
<p><small><font face="Arial">Overskrift:</font></small></p>
<p><input type="text" name="over" size="34"></p>
<p><small><font face="Arial">Nyheden:</font></small></p>
<p><textarea rows="7" name="besked" cols="25"></textarea></p>
<p><input type="submit" value="Send"> <input type="reset" value="Slet alt"></p>
</form>
<hr>
</body>
</html>
<?
}
else { ?>
<html>
<head>
<title><? print $titel ?></title>
</head>
<body>
<hr>
<p align="center"><font face="Arial">[<a href="?action=write"> Opret nyhed | </a><a href="?action=view">Læs nyheder ]</a></font></p>
<hr>
</body>
<html>
<?
}
?>