This little program can make an access log for certain pages, and the log file can be analyzed by other log analyzing software. If you want to get the combined format log with referer and user agent information, or you want to know the referer information of certain pages, but your hosting provider doesn't offer access log downloading, or just provide the common format log, then you can use this program.
By : milly
<?php
/* http://www.china-on-site.com/flexphpsite/ This little program can make an access log for certain pages, and the log file can be analyzed by other log analyzing software. If you want to get the combined format log with referer and user agent information, or you want to know the referer information of certain pages, but your hosting provider doesn't offer access log downloading, or just provide the common format log, then you can use this program. */
//settings
$logwriter_logformat = "combined"; // log format,combined or common $logwriter_logdir = "C:/apache/htdocs/logwriter/"; // physical path where your log file located $logwriter_logfilename = "access.log"; // your log file's filename $logwriter_timezone = "+0800"; // your server's time zone. +0800 means GMT+8
function logwriter_writelog($logstring){
global $logwriter_logdir,$logwriter_logfilename; $fullpathfilename = $logwriter_logdir.$logwriter_logfilename;
if (!is_file($fullpathfilename)) { print "Log file doesn't exist or file is corrupt."; return; }
if (!is_writeable($fullpathfilename)) { print "Log file is not writable,please change its permission."; return; }
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.