| verzia 1.24, 2002/03/19 23:20:39 |
verzia 1.25, 2002/03/20 22:10:05 |
|
|
| * - removed all errors and warnings in code (undefined keys |
* - removed all errors and warnings in code (undefined keys |
| * in arrays, bad eval() processing, etc.) |
* in arrays, bad eval() processing, etc.) |
| * 19/03/2002 - use of PHP's substr() instead SQL's substring() |
* 19/03/2002 - use of PHP's substr() instead SQL's substring() |
| |
* - private method _error() removed, PEAR error object is now |
| |
* returned on error |
| */ |
*/ |
| |
|
| define('WEB_LOG_VALUE_SUBSTR_LENGTH', 255); |
define('WEB_LOG_VALUE_SUBSTR_LENGTH', 255); |
| define('WEB_LOG_SESSION_TIMEOUT_DEFAULT', 1800); |
define('WEB_LOG_SESSION_TIMEOUT_DEFAULT', 1800); |
| define('WEB_LOG_RAW_LOG_DEFAULT', 1); |
define('WEB_LOG_RAW_LOG_DEFAULT', 1); |
| |
|
| /* |
/* |
| * Ident library |
* Ident library |
| Riadok 446 class Web_Log { |
|
| Riadok 448 class Web_Log { |
|
| * |
* |
| * Gets whole properties array. |
* Gets whole properties array. |
| */ |
*/ |
| function getPropertyArray() |
|
| |
function getPropertiesArray() |
| { |
{ |
| return $this->_props; |
return $this->_props; |
| } |
} |
| Riadok 472 class Web_Log { |
|
| Riadok 475 class Web_Log { |
|
| * _error() |
* _error() |
| * |
* |
| * Error handling function. TODO: improve! |
* Error handling function. TODO: improve! |
| */ |
* |
| |
|
| function _error($message = "Unknown error") { |
function _error($message = "Unknown error") { |
| die ("<b>phpWebLogAnalyzer fatal failure</b>: " . $message |
die ("<b>phpWebLogAnalyzer fatal failure</b>: " . $message |
| Riadok 481 class Web_Log { |
|
| Riadok 484 class Web_Log { |
|
| |
|
| return false; |
return false; |
| } |
} |
| |
*/ |
| |
|
| /* |
/* |
| * _checkDB() |
* _checkDB() |
| Riadok 496 class Web_Log { |
|
| Riadok 500 class Web_Log { |
|
| } |
} |
| |
|
| if (DB::isError($this->_db)) { |
if (DB::isError($this->_db)) { |
| $this->_error($this->_db->getMessage()); |
return $this->_db; |
| |
//$this->_error($this->_db->getMessage()); |
| } |
} |
| |
|
| $this->_db->setFetchMode(DB_FETCHMODE_ASSOC); |
$this->_db->setFetchMode(DB_FETCHMODE_ASSOC); |
| Riadok 623 class Web_Log { |
|
| Riadok 628 class Web_Log { |
|
| $this->_props[$prop_name]['table'], |
$this->_props[$prop_name]['table'], |
| $this->_props[$prop_name]['value']); |
$this->_props[$prop_name]['value']); |
| |
|
| |
if (DB::isError($id)) |
| |
return $id; |
| |
|
| if (intval($id)) |
if (intval($id)) |
| $this->_props[$prop_name]['id'] = $id; |
$this->_props[$prop_name]['id'] = $id; |
| } |
} |
| Riadok 642 class Web_Log { |
|
| Riadok 650 class Web_Log { |
|
| if (! $this->_props['session_id']['disabled']) { |
if (! $this->_props['session_id']['disabled']) { |
| $session_id = $this->_getSessionID(); |
$session_id = $this->_getSessionID(); |
| |
|
| |
if (DB::isError($session_id)) |
| |
return $session_id; |
| |
|
| if (intval($session_id)) |
if (intval($session_id)) |
| $this->_props['session_id']['id'] = |
$this->_props['session_id']['id'] = |
| $this->_props['session_id']['value'] = |
$this->_props['session_id']['value'] = |
| Riadok 707 class Web_Log { |
|
| Riadok 718 class Web_Log { |
|
| $result = $this->_db->query($query); |
$result = $this->_db->query($query); |
| |
|
| if (DB::isError($result)) { |
if (DB::isError($result)) { |
| $this->_error($result->getMessage()); |
return $result; |
| |
//$this->_error($result->getMessage()); |
| } |
} |
| |
|
| $this->_db->disconnect(); |
$this->_db->disconnect(); |
| Riadok 734 class Web_Log { |
|
| Riadok 746 class Web_Log { |
|
| ."' limit 1"; // TODO: 'limit' is MySQL dependent, or no? |
."' limit 1"; // TODO: 'limit' is MySQL dependent, or no? |
| $id = $this->_db->getOne($query); |
$id = $this->_db->getOne($query); |
| |
|
| if (DB::isError($id)) |
if (DB::isError($id)) { |
| $this->_error($id->getMessage()); |
return $id; |
| |
//$this->_error($id->getMessage()); |
| |
} |
| |
|
| if ($id) |
if ($id) |
| return $id; |
return $id; |
| Riadok 772 class Web_Log { |
|
| Riadok 786 class Web_Log { |
|
| /* This is an expected error. If it will be returned |
/* This is an expected error. If it will be returned |
| again we will count it seriously. */ |
again we will count it seriously. */ |
| } |
} |
| else |
else { |
| $this->_error($result->getMessage()); |
return $result; |
| |
//$this->_error($result->getMessage()); |
| |
} |
| } |
} |
| else { |
else { |
| /* No errors, insert succeed. */ |
/* No errors, insert succeed. */ |
| Riadok 785 class Web_Log { |
|
| Riadok 801 class Web_Log { |
|
| $query = "select last_insert_id()"; |
$query = "select last_insert_id()"; |
| $id = $this->_db->getOne($query); |
$id = $this->_db->getOne($query); |
| |
|
| if (DB::isError($id)) |
if (DB::isError($id)) { |
| $this->_error($id->getMessage()); |
return $id; |
| |
//$this->_error($id->getMessage()); |
| |
} |
| |
|
| if ($id) |
if ($id) |
| return $id; |
return $id; |
| Riadok 835 class Web_Log { |
|
| Riadok 853 class Web_Log { |
|
| ." limit 1"; |
." limit 1"; |
| $row = $this->_db->getRow($query); |
$row = $this->_db->getRow($query); |
| |
|
| if (DB::isError($row)) |
if (DB::isError($row)) { |
| $this->_error($row->getMessage()); |
return $row; |
| |
//$this->_error($row->getMessage()); |
| |
} |
| |
|
| if (is_array($row) |
if (is_array($row) |
| && ($row['diff_sec'] < $this->_session_timeout) |
&& ($row['diff_sec'] < $this->_session_timeout) |
| Riadok 859 class Web_Log { |
|
| Riadok 879 class Web_Log { |
|
| ." from $table"; |
." from $table"; |
| $id = $this->_db->getOne($query); |
$id = $this->_db->getOne($query); |
| |
|
| if (DB::isError($id)) |
if (DB::isError($id)) { |
| $this->_error($id->getMessage()); |
return $id; |
| |
//$this->_error($id->getMessage()); |
| |
} |
| |
|
| if ($id) |
if ($id) |
| return $id; |
return $id; |
| Riadok 920 class Web_Log { |
|
| Riadok 942 class Web_Log { |
|
| |
|
| $count = $this->_db->getOne($query); |
$count = $this->_db->getOne($query); |
| |
|
| if (DB::isError($count)) |
if (DB::isError($count)) { |
| $this->_error($count->getMessage()); |
return $count; |
| |
//$this->_error($count->getMessage()); |
| |
} |
| |
|
| if (isset($count)) |
if (isset($count)) |
| return $count; |
return $count; |
| Riadok 961 class Web_Log { |
|
| Riadok 985 class Web_Log { |
|
| |
|
| $active_sessions = $this->_db->getCol($query); |
$active_sessions = $this->_db->getCol($query); |
| |
|
| if (DB::isError($active_sessions)) |
if (DB::isError($active_sessions)) { |
| $this->_error($active_sessions->getMessage()); |
return $active_sessions; |
| |
//$this->_error($active_sessions->getMessage()); |
| |
} |
| |
|
| if ($this->_raw_log) |
if ($this->_raw_log) |
| $this->_cache_raw_log_active_sessions = $active_sessions; |
$this->_cache_raw_log_active_sessions = $active_sessions; |