-
1
- #1
rossmcl
Programmer
- Apr 18, 2000
- 128
Hi,
This is probably a really easy one...
I use the below code to store some information on a website visitor to a text file.
The thing that is annoying me is that it appends the information to the bottom of the file, and it is now a pain to scroll down to see recent visitors. So I want to append it to the top of the file instead.
What do I have to change in my code to do that?
Thanks
ross
<?php
$filename = "VisitorLog.txt";
$handle = fopen ($filename, "a+"
;
$todaydate = date("Y-m-d H:i:s"
;
$visitorInfo = $HTTP_SERVER_VARS['REMOTE_ADDR'];
fwrite($handle, "\r\n" . $todaydate . ' ' . $visitorInfo);
fclose( $handle );
?>
This is probably a really easy one...
I use the below code to store some information on a website visitor to a text file.
The thing that is annoying me is that it appends the information to the bottom of the file, and it is now a pain to scroll down to see recent visitors. So I want to append it to the top of the file instead.
What do I have to change in my code to do that?
Thanks
ross
<?php
$filename = "VisitorLog.txt";
$handle = fopen ($filename, "a+"
$todaydate = date("Y-m-d H:i:s"
$visitorInfo = $HTTP_SERVER_VARS['REMOTE_ADDR'];
fwrite($handle, "\r\n" . $todaydate . ' ' . $visitorInfo);
fclose( $handle );
?>