Records
IP Address
Refer Page
Current Page
Local Date
Local Time
User Agent
Logs to a file called log.html needs to be CHMOD to 777 to make it writable.
I would also suggest protecting the page from the public if your using apache you can do this by using basic auth on htaccess file.
Example Log Outcome:
Wednesday 11 November 2009 10:10pm
IP: 82.3.557.17
Page: /test.php
Refer: http://www.randomsit...orum.php?=24924
Useragent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Php Code
©2011, copyright BLACK BURN
IP Address
Refer Page
Current Page
Local Date
Local Time
User Agent
Logs to a file called log.html needs to be CHMOD to 777 to make it writable.
I would also suggest protecting the page from the public if your using apache you can do this by using basic auth on htaccess file.
Example Log Outcome:
Wednesday 11 November 2009 10:10pm
IP: 82.3.557.17
Page: /test.php
Refer: http://www.randomsit...orum.php?=24924
Useragent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Php Code
<?php $log = 'log.html'; $ip = $_SERVER['REMOTE_ADDR']; $page = $_SERVER['REQUEST_URI']; $refer = $_SERVER['HTTP_REFERER']; $date_time = date("l j F Y g:ia", time() - date("Z")) ; $agent = $_SERVER['HTTP_USER_AGENT']; $fp = fopen("log.html", "a"); fputs($fp, " <b>$date_time</b> <br> <b>IP: </b>$ip<br><b>Page: </b>$page<br><b>Refer: </b>$refer<br><b>Useragent: </b>$agent <br><br> "); flock($fp, 3); fclose($fp); ?>
©2011, copyright BLACK BURN
0 comments:
Post a Comment