Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Saturday, April 20, 2024

File: [Platon] / phpWebLogAnalyzer / test.php (download)

Revision 1.10, Thu Mar 28 21:49:57 2002 UTC (22 years ago) by jombik9

Changes since 1.9: +16 -17 lines

 * 28/03/2002 - web server variable remote_host is used if it is set
 *            - support for resolving hostnames from IP address fields
 *              containing commas
 *            - truncating hostnames and IP addresses implementation

<?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>";
        echo "<b>".htmlspecialchars($key)."</b>";
        echo "</td><td>";
        echo htmlspecialchars($val);
        echo "</td></tr>";
    }

    die();
}

function pear_error_handler($err_obj)
{
    $error_string = $err_obj->getMessage() . ' | ' . $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 (1) {
    $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/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top