Can anyone help the noob?
$logfile= 'log.txt'; $IP = $_SERVER['REMOTE_ADDR']; $logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].' target=_blank>'.$_SERVER['REMOTE_ADDR'].'</a>'; $fp = fopen($logfile, "a"); fwrite($fp, $logdetails); fwrite($fp, "<br>"); fclose($fp);
As you probably know the code writes the text, IP address, and html code to a text file in chronological order. I would like it to list the events in reverse-chronological order. I muddled with it for a while, trying to make the php write to the beginning_of_file, but anything that was left in the text file was overwritten. I thought perhaps I could make the php read the text file backwards, but that didn’t work. So I’ve tried. Any help would be greatly appreciated!