* Copyright (c) 2001-2002 Platon SDG, http://www.platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://www.platon.sk/projects/phpWebLogAnalyzer/
*/
function get_mtime()
{
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
return $mtime;
}
$start_time = get_mtime();
// this function will handle all errors reported by PHP
function php_error_handler($errno, $errstr, $errfile, $errline)
{
echo "
";
echo "";
echo "An error occured";
echo " |
";
foreach(array(
'file' => $errfile,
'line' => $errline,
'code' => $errno,
'message' => $errstr)
as $key => $val) {
echo "";
echo "".htmlspecialchars($key)."";
echo " | ";
echo nl2br(htmlspecialchars($val));
echo " |
";
}
die();
}
function pear_error_handler($err_obj)
{
$error_string = $err_obj->getMessage() . "\n" . $err_obj->getDebugInfo();
trigger_error($error_string, E_USER_ERROR);
}
error_reporting (E_ALL ^ E_NOTICE);
set_error_handler('php_error_handler');
require_once './phpWebLogAnalyzer.inc.php';
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'pear_error_handler');
$weblog = new Web_Log('mysql://test:test@localhost/test');
$weblog->enableTruncateNames();
$weblog->enableRawLog();
//$weblog->disableRawLog();
$weblog->enablePropertyCache('remote_host');
//$weblog->disableProperty('session_id');
$weblog->registerAccess(3);
echo ("
Session ID: "
. $weblog->getPropertyValue("session_id") . "
");
if (0) {
$weblog->enableRawLog();
echo("
Raw session count: "
. $weblog->getSessionsCount()
. "
");
$weblog->disableRawLog();
echo("
Normal session count: "
. $weblog->getSessionsCount()
. "
");
$weblog->enableRawLog();
echo "
Raw active sessions: ";
$active_sessions = $weblog->getActiveSessions();
var_dump($active_sessions);
echo "
";
$weblog->disableRawLog();
echo "
Normal active sessions: ";
$active_sessions = $weblog->getActiveSessions();
var_dump($active_sessions);
echo "
";
}
echo("
Processing time: "
. sprintf("%.2f", get_mtime() - $start_time));
$debug = isset($HTTP_GET_VARS['debug']) ? $HTTP_GET_VARS['debug'] : 0;
if (intval($debug) > 0) {
ob_start();
var_dump($weblog->_props);
$contents = ob_get_contents();
ob_end_clean();
echo '
';
echo htmlspecialchars($contents);
echo '
';
}
echo("
Click here to get HTTP refferer work.");
echo("
Click here to get var_dump()
of all variables.");
$weblog->destroy();
?>