Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 23. október 2026

Rozdiely pre phpWebLogAnalyzer/phpWebLogAnalyzer.inc.php medzi verziami 1.25 a 1.26

verzia 1.25, 2002/03/20 22:10:05 verzia 1.26, 2002/03/28 21:49:57
Riadok 44 
Riadok 44 
  * 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   *            - private method _error() removed, PEAR error object is now
  *              returned on error   *              returned on error
    * 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
  */   */
   
 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);
   define('WEB_LOG_TRUNCATE_NAMES_DEFAULT',     0);
   
 /*  /*
  * Ident library   * Ident library
Riadok 92  class Web_Log {
Riadok 97  class Web_Log {
   
         var $_raw_log;          var $_raw_log;
   
           /* Short host names variable
   
              $_truncate_names - replace the last component of IP and the first
                                 component of hostname if exists address with '*'
                                 character
            */
   
           var $_truncate_names;
   
         /* Database variables          /* Database variables
   
        $_db - PEAR DB object         $_db - PEAR DB object
Riadok 310  class Web_Log {
Riadok 324  class Web_Log {
                         $session_timeout = WEB_LOG_SESSION_TIMEOUT_DEFAULT;                          $session_timeout = WEB_LOG_SESSION_TIMEOUT_DEFAULT;
   
                 $this->_session_timeout = $session_timeout;                  $this->_session_timeout = $session_timeout;
                   $this->_raw_log         = WEB_LOG_RAW_LOG_DEFAULT;
                   $this->_truncate_names  = WEB_LOG_TRUNCATE_NAMES_DEFAULT;
   
                 unset($this->_db);                  unset($this->_db);
                 unset($this->_dsn);                  unset($this->_dsn);
Riadok 318  class Web_Log {
Riadok 334  class Web_Log {
                 unset($this->_cache_active_sessions);                  unset($this->_cache_active_sessions);
                 unset($this->_cache_raw_log_active_sessions);                  unset($this->_cache_raw_log_active_sessions);
   
                 $this->_raw_log = WEB_LOG_RAW_LOG_DEFAULT;  
   
                 if (! empty($dsn)) {                  if (! empty($dsn)) {
                         $this->setDSN($dsn);                          $this->setDSN($dsn);
                 }                  }
Riadok 385  class Web_Log {
Riadok 399  class Web_Log {
         }          }
   
         /*          /*
            * enableShortNames(), disableShortNames()
            *
            * Enable/disable of short IP addresses and hostnames usage.
            */
   
           function enableTruncateNames()
           {
                   $this->_truncate_names = 1;
           }
   
           function disableTruncateNames()
           {
                   $this->_truncate_names = 0;
           }
   
           /*
          * enableProperty(), disableProperty()           * enableProperty(), disableProperty()
          *           *
          * Enable/disable loging of specific property.           * Enable/disable loging of specific property.
Riadok 472  class Web_Log {
Riadok 502  class Web_Log {
         }          }
   
         /*          /*
          * _error()  
          *  
          * Error handling function. TODO: improve!  
          *  
   
         function _error($message = "Unknown error") {  
                 die ("<b>phpWebLogAnalyzer fatal failure</b>: " . $message  
                                 . "<br>Please contact webmaster or system administrator"  
                                 . " of this page with this problem.<br>");  
   
                 return false;  
         }  
         */  
   
         /*  
          * _checkDB()           * _checkDB()
          *           *
          * Checks if $this->_db is a valid PEAR DB object. If not it creates a new           * Checks if $this->_db is a valid PEAR DB object. If not it creates a new
Riadok 508  class Web_Log {
Riadok 523  class Web_Log {
         }          }
   
         /*          /*
            * _resolveIP()
            *
            * Resolves IP address to hostname.
            */
   
           function _resolveIP($addr)
           {
                   $host = '';
                   $addr_ar = (strchr($addr, ',') ? explode(',', $addr) : array($addr));
                   $addr_idx = count($addr_ar);
   
                   while ($addr_idx > 0) {
                           $addr_idx--;
                           $addr_ar[$addr_idx] = trim($addr_ar[$addr_idx]);
   
                           if (preg_match("/^(\d{1,3}\.){3}\d{1,3}$/", $addr_ar[$addr_idx])) {
                                   $host = @gethostbyaddr($addr_ar[$addr_idx]);
                                   if (! strcmp($host, $addr_ar[$addr_idx]))
                                           $host = '';
                                   break;
                           }
                   }
   
                   return $host;
           }
   
           /*
            * _truncateName()
            *
            * Truncates hostname or IP address.
            */
   
           function _truncateName($name)
           {
                   $name_ar = explode('.', $name);
   
                   if (count($name_ar) > 2) {
                           if (is_numeric($name_ar[0])) {
                                   array_pop($name_ar);
                                   $name = join('.', $name_ar) . '.*';
                           } else {
                                   array_shift($name_ar);
                                   $name = '*.' . join('.', $name_ar);
                           }
                   }
   
                   return $name;
           }
   
           /*
          * registerAccess()           * registerAccess()
          *           *
          * Register access. Insert one record to accesses table.           * Register access. Insert one record to accesses table.
Riadok 549  class Web_Log {
Riadok 614  class Web_Log {
                 $proxy_addr = '';                  $proxy_addr = '';
                 $proxy_host = '';                  $proxy_host = '';
   
   
                 if (! empty($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])) {                  if (! empty($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])) {
                         $remote_addr = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];                          $remote_addr = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
                         $proxy_addr = $HTTP_SERVER_VARS["REMOTE_ADDR"];                          $proxy_addr = $HTTP_SERVER_VARS["REMOTE_ADDR"];
Riadok 558  class Web_Log {
Riadok 622  class Web_Log {
                         $remote_addr = $HTTP_SERVER_VARS["REMOTE_ADDR"];                          $remote_addr = $HTTP_SERVER_VARS["REMOTE_ADDR"];
                 }                  }
   
                   /* REMOVE ME */
                   //$remote_addr .= ", 192.168.1.3, 111.111.2., unknown";
   
                 if (! $this->_props['remote_addr']['disabled'])                  if (! $this->_props['remote_addr']['disabled'])
                         $this->_props['remote_addr']['value'] = $remote_addr;                          $this->_props['remote_addr']['value'] = $this->_truncate_names
                                   ? $this->_truncateName($remote_addr)
                                   : $remote_addr;
   
                 if (! $this->_props['proxy_addr']['disabled'])                  if (! $this->_props['proxy_addr']['disabled'])
                         $this->_props['proxy_addr']['value'] = $proxy_addr;                          $this->_props['proxy_addr']['value'] = $this->_truncate_names
                                   ? $this->_truncateName($proxy_addr)
                                   : $proxy_addr;
   
                 /*                  /*
                  * Host names resolving.                   * Host names resolving.
                  */                   */
   
                 if (! $this->_props['remote_host']['disabled']) {                  if (! $this->_props['remote_host']['disabled']) {
                         $remote_host = @gethostbyaddr($remote_addr);                          if (empty($HTTP_SERVER_VARS["REMOTE_HOST"])) {
                         if (! strcmp($remote_host, $remote_addr))                                  $remote_host = $this->_resolveIP($remote_addr);
                                 $remote_host = '';                                  $remote_host = 'neptun.kofola.xxx.sk';
                                   $this->_props['remote_host']['value'] = $this->_truncate_names
                         $this->_props['remote_host']['value'] = $remote_host;                                          ? $this->_truncateName($remote_host)
                                           : $remote_host;
                           }
                           else {
                                   $this->_props['remote_host']['value'] = $this->_truncate_names
                                           ? $this->_truncateName($HTTP_SERVER_VARS["REMOTE_HOST"])
                                           : $HTTP_SERVER_VARS["REMOTE_HOST"];
                           }
                 }                  }
   
                 if ($proxy_addr) {                  if ($proxy_addr) {
                         if ($this->_props['proxy_host']['disabled']) {                          if ($this->_props['proxy_host']['disabled']) {
                                 $proxy_host = @gethostbyaddr($proxy_addr);                                  $proxy_host = $this->_resolveIP($proxy_addr);
                                 if (! strcmp($proxy_host, $proxy_addr))                                  $this->_props['proxy_host']['value'] = $this->_truncate_names
                                         $proxy_host = '';                                          ? $this->_truncateName($proxy_host)
                                           : $proxy_host;
                                 $this->_props['proxy_host']['value'] = $proxy_host;  
                         }                          }
                 }                  }
   

Legend:
Odstranené z verzie1.25  
zmenené riadky
  Pridané vo verzii1.26

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok