i have this script :
<?php
date_default_timezone_set('Europe/Berlin');
$date = date('d/m/Y h:i', time());
$ip = getenv("REMOTE_ADDR");
echo read_and_delete_first_line('data.txt');
function read_and_delete_first_line($filename) {
$file = file($filename);
$output = $file[0];
unset($file[0]);
file_put_contents($filename, $file);
$file1 = fopen($filename, "a");
fputs ($file1, $output);
fclose ($file1);
return $output;
}
?>
this get the first line of file and move to last file, the problem is, if receve more request in same time, php remove all data from data.txt and save file empty .. how can resolve this problem ? is possible whit this method or need use mysql ?