This really begs the question of WTF you have a 10,000+ line file that you only need a couple lines from... seems like your logic is screwy.
every time my script is executed a line is added to a given image. right now every image is saved as new file because it needs to remain accessible in it's current state. at the moment there are only 200+ entries and the present image size is about 20 kb. but if i someday get 10'000 hits this would mean 200 mb of used disc space. (see www.ipdraw.org)
therefore i thought it would be a more adequate way to write each imageline() line into one text file and then as an archived entry is requested generate the image by only including line 1 - $request_no.
since i already save a file containing some vars for each visitor maybe something like this could be a possible solution:
$i = 1; while ($i <= $request_no) { $filename = "entry-" . $i . ".php"; include($filename); // contains $image, $ip and $color imageline($image, $ip[0], $ip[1], $ip[2], $ip[3], $color); $i++; }
This is really begging for a database. Why not store $ip one through four, the color, and the datetime in a table. Then you could easily pull data from any dates or days or months or whatever, and just loop through the results calling imageline() each time...
Or, just put the IP addresses and color (and maybe date) into a csv file. Just fopen() the file and use fgetcsv() to get a line at a time and call imageline() for each line.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php