Crea un file chiamato db.txt.
Codice PHP:
<form method="POST" action="" name="form">
<input type="text" name="testo">
<button type="submit">Invia</button>
<br />
<br />
<?
$db="db.txt";
if(isset($_POST['testo']))
fwrite(fopen($db,"a+"),htmlspecialchars(mysql_escape_string($_POST['testo']))."|".time()."\n");
foreach(file($db) as $ln=>$l){
$p=explode("|",$l);
$t[trim($p['1'])]=$p['0'];
}
if(!is_array($t) || count($t)<0)
exit("Nessun record nel database");
@krsort($t,SORT_NUMERIC);
reset($t);
for($i=1;$i<=5;$i++){
echo current($t)."<br />";
next($t);
}
?>