File: [Platon] / phpWebLogAnalyzer / test.php (download)
Revision 1.12, Mon Apr 15 19:47:17 2002 UTC (22 years ago) by jombik9
Changes since 1.11: +3 -3
lines
Code split into several independents parts.
Improvements.
|
<?php
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 "<table bgcolor=lightblue>";
echo "<tr><th colspan=2>";
echo "An error occured";
echo "</th></tr>";
foreach(array(
'file' => $errfile,
'line' => $errline,
'code' => $errno,
'message' => $errstr)
as $key => $val) {
echo "<tr><td align=left valign=top>";
echo "<b>".htmlspecialchars($key)."</b>";
echo "</td><td>";
echo nl2br(htmlspecialchars($val));
echo "</td></tr>";
}
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');
include("./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->disableProperty('session_id');
$weblog->registerAccess(3);
echo ("<hr>Session ID: "
. $weblog->getPropertyValue("session_id") . "<br>");
if (0) {
$weblog->enableRawLog();
echo("<hr>Raw session count: "
. $weblog->getSessionsCount()
. "<br>");
$weblog->disableRawLog();
echo("<hr>Normal session count: "
. $weblog->getSessionsCount()
. "<br>");
$weblog->enableRawLog();
echo "<hr>Raw active sessions: ";
$active_sessions = $weblog->getActiveSessions();
var_dump($active_sessions);
echo "<br>";
$weblog->disableRawLog();
echo "<hr>Normal active sessions: ";
$active_sessions = $weblog->getActiveSessions();
var_dump($active_sessions);
echo "<br>";
}
echo("<hr>Processing time: "
. sprintf("%.2f", get_mtime() - $start_time));
?>
Platon Group <platon@platon.org> http://platon.org/
|