![]() |
Php script line break..
Ok i found this script that shows referrer logs for traffic you send to it..
<?php $myFile = "./data.txt"; $fh = fopen($myFile, 'a') or die("can't open file"); fwrite($fh,"nReferer: "); fwrite($fh, ($_SERVER['HTTP_REFERER']) ); fwrite($fh,", "); fwrite($fh, ($_SERVER['HTTP_USER_AGENT']) ); fwrite($fh,", "); fwrite($fh, $_SERVER['REMOTE_ADDR']); fwrite($fh,", "); fwrite($fh, date('l jS of F Y h:i:s A') ); fclose($fh); ?> Anyone of making it seperate each new one and put it in a diff line.. right now it just jumbles em up.. |
If you want to pay I can have one of my progammers on bench create a solution for you. If so , hit me on icq.
|
PHP Code:
|
thanks drocd..
|
Will the script lag if a lot of hits r sent?
I mean i dont know how reliable it is to write to a text file every time someone hits the page. |
Yes, Disk I/O will be a drag whore if you're getting a lot of traffic to it.
If you dont want to be scouring/parsing apache logs, hit me up on ICQ - I've just the (free) things that is right up your street.... |
why aren't you storing this stuff in mysql? The problem with what you have now is that there are no file locks (flock), so you're going to be getting into a whole lotta mess with those kind of file writes with traffic.
Anyway, in answer to your original question, a line break is \n. *always* in within double quotes, never single eg fwrite($fh, $_SERVER['REMOTE_ADDR'] . "\n"); |
that is some horrible code
|
Quote:
|
All times are GMT -7. The time now is 05:02 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123