Non necessita di database per funzionare, ma consente di visualizzare soltanto l'ultima news inserita.
<?
include ("news.dat");
$naam = "YOUR_USERNAME";
$wachtwoord = "YOUR_PASSWORD";
if ($action == "beheer") {
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "Username:<br>\n";
echo "<input type=\"text\" name=\"login\"><br>\n";
echo "Password:<br>\n";
echo "<input type=\"password\" name=\"pass\"><br>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"nieuw\">\n";
echo "<input type=\"submit\" value=\"Ok\">\n";
echo "</form>\n";
}
elseif ($action == "nieuw") {
if ($login == $naam && $pass == $wachtwoord){
echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
echo "Whats the header?<br>\n";
echo "<input type=\"text\" size=\"40\" name=\"hoofd\" value=\"$kop\"><br>\n";
echo "Whats the text?<br>\n";
echo "<textarea name=\"bericht\" cols=\"60\" rows=\"20\">$tekst</textarea><br>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"vernieuw\">\n";
echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
echo "<input type=\"hidden\" name=\"login\" value=\"$login\">\n";
echo "<input type=\"submit\" value=\"Change\">\n";
echo "<input type=\"reset\" value=\"again\">\n";
echo "</form>\n";
}
else {
echo "Password or username is wrong\n";
}
}
elseif ($action == "vernieuw") {
if ($login == $naam && $pass == $wachtwoord){
$hoofd = AddSlashes($hoofd);
$bericht = AddSlashes($bericht);
$datafile=fopen("news.dat","w");
fputs($datafile,"<? \n\$kop=\"$hoofd\";\n\$tekst=\"$bericht\";\n
?>");
fclose($datafile);
echo "Text is changed<br>\n";
echo "Klick <a href=\"$PHP_SELF\">here</a> to go back\n";
}
else {
echo "Password or username is wrong\n";
}
}
else {
echo "<pre><font face=\"Arial\" size=\"2\"><b>$kop</b>
$tekst</font></pre>";
}
?>
Per avviare: http://il_tuo_server.com/news.php3?action=beheer
![]()
![]()