Codice PHP:
$nomefile = $_SERVER['SCRIPT_NAME'];
$nomefile = str_replace("/","",$nomefile);
$nomefile = str_replace(".php","",$nomefile);
$nomefile = $nomefile.".txt";
if (!file_exists($nomefile)) {
touch($nomefile); // crea il file
}
else {
$fp = fopen($nomefile,"r"); // apre il file in lettura
}