PHP Code Help On My Website Please (Please Answer)?

Can someone please make/get me a code to clear all text from a text file on my site if the file gets a certain size. Say the text file gets to 5MB big, I want the text to all clear from the file when someone visits my site.

The reason being is I made a ip log, where it gets the visitors ip, gets the date, time and page, then it writes it to a text file. But when the text file gets to full, I want the text in the file to clear.
 
i don't really think php can do that unless you log the ip in a sql database
w3schools.com has lots of info about programming
 
$filename = "iplog.txt"'

if (filesize($filename)>5242880)
{
$file = fopen($filename,"w");
fclose($file);

}

Run that when the desired page executes... it will clear the file if its over 5MB
 
Back
Top