Codice PHP:
if (fopen("dati.txt","rw")==1){
$dati=fopen("dati.txt","rw");}
else{ exit(
"Impossibile aprire il file");}
if 
fgets($dati1)=1{$buffer=fgets($dati1);}else
{
check()};
function_check(){
$rand=rand([1],6);
fwrite("$dati""$rand");
if 
fwrite("$dati""$rand")=1{return true; }else{exit("Impossibile scrivere il file");}
fclose($dati);