';
global $help;
$help=array (
'users' => 'Display user history. The optional filter narrows the users displayed to only those with matching IP addresses. Regular expression escape sequences can be used.
Accesskey: u Option accesskey: i',
'referrer' => 'Display referrers, optionally showing only those matching the filter, which is a regular expression.
Accesskey: e Option accesskey: r',
'resources' => 'Display resources, optionally showing only those matching the filter, a regular expression.
Accesskey: c Option accesskey: v',
'time' => 'Display hits by time, the optional filter narrows the hits to the given time, in the format DD/MMM/YYYY: HH:MM:SS (or whatever matches the format in the log file). Regular expression escape sequences can also be used.
Time filter aliases exist: today, yesterday, thisweek, thismonth, and thisyear. Unless the interval has been explicitly set (via hits, these result in the interval being set to hour, hour, day, day, and mon, respectively.
Accesskey: t Option accesskey: y',
'hits' => 'Display hit counts, using the given time interval, which by default is hour. Other valid intervals are year, mon, day, hour, min, and sec. Accesskey: h',
'logfile' => 'The log file to process. If not specified, standard input is used as input.',
'lookup-ips' => 'Display IP names instead of addresses, when used with the users option. This adds significant processing time.i
Accesskey: l',
'sort-by-name' => 'Sort resources and referrers by name instead of by count.
Accesskey: s'
);
//
// class add_block
// add block for each group of options
//
class add_block
{
// block content
var $return;
var $disabled;
var $cmd="";
var $js_disabled="";
var $js_unabled="";
var $name;
var $have_filter;
//start block
function add_block($name, $check_name="", $check_accesskey="")
{
$this->name=$name;
$this->disabled="no";
$begin="\n";
if ($this->js_disabled != "no")
{
$return="\n";
$return.=$this->return;
} else {
$return=$this->return;
}
return $return;
}
}
//
// function add_help
// add help button ([?]) and tooltip with wz_tooltip.js
//
function add_help($name)
{
global $help;
if (isset($help["$name"]))
return '[?]';
}
//
// function return_post
// return the $_POST var for $name
// is get_magic_quotes_gpc is not allow, addslashes to $name
//
function return_post($name)
{
if (isset($_POST["$name"])) $return=$_POST["$name"];
else $return="";
if (!get_magic_quotes_gpc())
{
$return=addslashes($return);
}
return $return;
}
// add block for the referrer option
$sort_block = new add_block('sortbyname');
$ref_block = new add_block('referrer', 'referrer', 'e');
$ref_block->filter('referrer_filter', 'r');
$sort_block->add($ref_block->close());
$res_block = new add_block('resources', 'resources', 'c');
$res_block->filter('resources_filter', 'v');
$sort_block->add($res_block->close());
$sort_block->check('sortbyname', 's');
print $sort_block->close();
// add block for the users option
$users_block = new add_block('users', 'users', 'u');
$users_block->filter('users_filter', 'i');
$users_block->check('lookupips', 'l', "yes");
print $users_block->close();
// add block for the time option
$time_block = new add_block('time', 'time', 't');
$time_block->filter('time_filter', 'y');
print $time_block->close();
// add block for logfile option
$log_block = new add_block('logfile');
if ($handle = opendir("$logfile_dir"))
{
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$arrlog[]=$file;
}
}
closedir($handle);
}
$log_block->select('logfile', $logdefault, $arrlog);
print $log_block->close();
$logfile = return_post('logfile');
// add block for the hits option
$hits_block = new add_block('hits', 'hits', 'h');
$arr=array('year', 'mon', 'day', 'hour', 'min', 'sec');
$hits_block->select('hits_filter', 'hour', $arr);
print $hits_block->close();
// add button ok
print '
';
print '';
if (return_post('ok') == "ok" )
{
if (!is_file("$logfile_dir/$logfile"))
{
print "logfile ($logfile_dir/$logfile) is not a regular file";
exit;
}
$cmd.=" $logfile_dir/$logfile ";
print '# ' . $cmd;
print '