* 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/ */ /* $Platon: test.php,v 1.17 2002/09/05 01:27:32 nepto Exp $ */ 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 ""; foreach(array( 'file' => $errfile, 'line' => $errline, 'code' => $errno, 'message' => $errstr) as $key => $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'); # # Object creation # $weblog = new Web_Log('mysql://test:test@localhost/test'); # # Web log object configuration # $weblog->enableTruncateNames(); $weblog->enableRawLog(); //$weblog->disableRawLog(); $weblog->enablePropertyCache('remote_host'); # # Registering access # (in following `if' use 1 for normal log, 0 for remote log) # if (1) { //$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 "
"; } } else { echo '
Remote log: '; $ret = $weblog->remoteLog('http://maxim.platon.sk/~ondrej/development/phpWebLogAnalyzer/utils/remote-log.php'); if (PEAR::isError($ret)) { echo $ret->getMessage(); } else { echo 'OK'; } } # # Processing time counting # echo("
Processing time: ".sprintf("%.2f", get_mtime() - $start_time)); # # Debug information printing # $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 '
'; } # # Navigation links # echo("
Click here to get HTTP refferer work."); echo("
Click here to get var_dump() of all variables."); # # Object destroying # $weblog->destroy(); ?>
"; echo "An error occured"; echo "
"; echo "".htmlspecialchars($key).""; echo ""; echo nl2br(htmlspecialchars($val)); echo "