'; 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
$name "; $begin.=add_help("$name"); $begin.=""; $this->add($begin); if ($check_name != "") $this->check($check_name, $check_accesskey, "", "yes"); else $this->js_disabled="no"; } // add content to the block function add($data) { $this->return.="$data"; } function add_cmd($cmd, $filter="no") { if ($filter == "yes") { if ($this->have_filter == "yes") $this->cmd.="='$cmd'"; $this->have_filter="no"; } else { $this->cmd.=" $cmd"; $this->have_filter="yes"; } } function add_js($name) { if ($this->js_disabled != "no") { $this->js_disabled.="document.p." . $name . ".disabled=false;\n"; $this->js_unabled.="document.p." . $name . ".disabled=true;\n"; } } // // 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; } function check($name, $accesskey, $help="", $init="") { $post=$this->return_post("$name"); $return='name . '()"'; if ($accesskey != "") $return.=' accesskey="' . $accesskey . '"'; // if ($this->disabled == "yes") $return.='disabled '; if ($post == "on") { $return.= ' checked="true"'; $this->add_cmd("--$name"); } if ($init == "yes") { if ($post != "on") $this->disabled="yes"; } else { $this->add_js($name); } $pos=strcspn($name, $accesskey); $return.='>activate ' . substr($name,0,$pos) . "" . $accesskey . "" . substr($name,$pos+1) . ' '; if ($help == "yes") $return.=add_help("$name"); $this->add($return . "
"); } function filter($input, $accesskey) { $this->add_js($input); $post=$this->return_post("$input"); $return=' with filter (optional) disabled == "yes") $return.='disabled '; $return.='value="' . stripslashes($post) . '">'; if ($post != "") $this->add_cmd("$post", "yes"); $this->add($return . "
"); } function select($name, $default, $array) { $this->add_js($name); $return='
'; $this->add($return); } function close($data="") { global $cmd; if ($data != "") $this->add($data); if ($this->disabled != "yes") $cmd.=$this->cmd; $this->return.="
"; 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 '
';
		print passthru("$cmd 2>&1", $error);
		print '
'; } ?>