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.8 a 1.9

verzia 1.8, 2001/10/02 17:54:46 verzia 1.9, 2001/11/19 22:20:58
Riadok 20 
Riadok 20 
  * 02/10/2001 - added support for remote address resolving   * 02/10/2001 - added support for remote address resolving
  *            - new version of libident used   *            - new version of libident used
  *            - added support for proxy servers logging   *            - added support for proxy servers logging
    * 19/11/2001 - session_id column added
    *            - sessions implemented
    *            - various bugfixes and SQL improvements
  */   */
   
 /*  /*
Riadok 53  function phpWebLogAnalyzer_open_db_conne
Riadok 56  function phpWebLogAnalyzer_open_db_conne
         global $phpWebLogAnalyzer_MYSQL_DATABASE;          global $phpWebLogAnalyzer_MYSQL_DATABASE;
   
         $phpWebLogAnalyzer_db_handle = @mysql_connect(          $phpWebLogAnalyzer_db_handle = @mysql_connect(
                         "$phpWebLogAnalyzer_MYSQL_HOST:$phpWebLogAnalyzer_MYSQL_PORT",                          "$phpWebLogAnalyzer_MYSQL_HOST:$phpWebLogAnalyzer_MYSQL_PORT",
                         $phpWebLogAnalyzer_MYSQL_USERNAME,                          $phpWebLogAnalyzer_MYSQL_USERNAME,
                         $phpWebLogAnalyzer_MYSQL_PASSWORD);                          $phpWebLogAnalyzer_MYSQL_PASSWORD);
   
Riadok 181  function phpWebLogAnalyzer_register_acce
Riadok 184  function phpWebLogAnalyzer_register_acce
         $ident = new Net_Ident($ip_addr, $REMOTE_PORT, $SERVER_PORT);          $ident = new Net_Ident($ip_addr, $REMOTE_PORT, $SERVER_PORT);
   
         if ($ident->status() == 1) {          if ($ident->status() == 1) {
         // print "Ident query failed: " . $ident->error() . ".<br>\n";                  // print "Ident query failed: " . $ident->error() . ".<br>\n";
         }          }
         else {          else {
                 $ident_user = $ident->user();                  $ident_user = $ident->user();
Riadok 225  function phpWebLogAnalyzer_register_acce
Riadok 228  function phpWebLogAnalyzer_register_acce
                                         'weblog_remote_addrs', $proxy_ip_addr),                                          'weblog_remote_addrs', $proxy_ip_addr),
                         'proxy_host_id' => phpWebLogAnalyzer_get_id(                          'proxy_host_id' => phpWebLogAnalyzer_get_id(
                                         'weblog_remote_hosts', $proxy_hostname), // *                                          'weblog_remote_hosts', $proxy_hostname), // *
                         'remote_addr_id' => phpWebLogAnalyzer_get_id(                          'remote_addr_id' => ($remote_addr_id =
                                         'weblog_remote_addrs', $ip_addr),                                          phpWebLogAnalyzer_get_id(
                                                   'weblog_remote_addrs', $ip_addr)),
                         'remote_host_id' => phpWebLogAnalyzer_get_id(                          'remote_host_id' => phpWebLogAnalyzer_get_id(
                                         'weblog_remote_hosts', $hostname), // *                                          'weblog_remote_hosts', $hostname), // *
                         'remote_port' => $REMOTE_PORT,                          'remote_port' => $REMOTE_PORT,
Riadok 252  function phpWebLogAnalyzer_register_acce
Riadok 256  function phpWebLogAnalyzer_register_acce
                                         'weblog_http_hosts', $HTTP_HOST),                                          'weblog_http_hosts', $HTTP_HOST),
                         'http_referer_id' => phpWebLogAnalyzer_get_id(                          'http_referer_id' => phpWebLogAnalyzer_get_id(
                                         'weblog_http_referers', $HTTP_REFERER),                                          'weblog_http_referers', $HTTP_REFERER),
                         'http_user_agent_id' => phpWebLogAnalyzer_get_id(                          'http_user_agent_id' => ($http_user_agent_id =
                                         'weblog_http_user_agents', $HTTP_USER_AGENT),                                          phpWebLogAnalyzer_get_id(
                                                   'weblog_http_user_agents', $HTTP_USER_AGENT)),
                         'script_filename_id' => phpWebLogAnalyzer_get_id(                          'script_filename_id' => phpWebLogAnalyzer_get_id(
                                         'weblog_script_filenames', $SCRIPT_FILENAME),                                          'weblog_script_filenames', $SCRIPT_FILENAME),
                         'request_uri_id' => phpWebLogAnalyzer_get_id(                          'request_uri_id' => phpWebLogAnalyzer_get_id(
Riadok 261  function phpWebLogAnalyzer_register_acce
Riadok 266  function phpWebLogAnalyzer_register_acce
                         'ident_username_id' => phpWebLogAnalyzer_get_id(                          'ident_username_id' => phpWebLogAnalyzer_get_id(
                                         'weblog_ident_usernames', $ident_user),                                          'weblog_ident_usernames', $ident_user),
                         'ident_ostype_id' => phpWebLogAnalyzer_get_id(                          'ident_ostype_id' => phpWebLogAnalyzer_get_id(
                                         'weblog_ident_ostypes', $ident_ostype)                                          'weblog_ident_ostypes', $ident_ostype),
                           'session_id' => phpWebLogAnalyzer_get_session_id(
                                           $remote_addr_id, $http_user_agent_id)
                                 );                                  );
   
   
Riadok 271  function phpWebLogAnalyzer_register_acce
Riadok 278  function phpWebLogAnalyzer_register_acce
   
                         foreach ($record as $key => $val) {                          foreach ($record as $key => $val) {
                                 $count++;                                  $count++;
                                   $sep = ($count < count($record) ? ", " : "");
   
                                 $keys .= $key . ($count < count($record) ? ", " : "");                                  $keys .= $key . $sep;
                                 $vals .= ($val ? "'$val'" : "NULL")                                  $vals .= ($val ? "'$val'" : "NULL") . $sep;
                                         . ($count < count($record) ? ", " : "");  
                         }                          }
   
                         $query = "insert into $phpWebLogAnalyzer_LOG_TABLE"                          $query = "insert into $phpWebLogAnalyzer_LOG_TABLE"
Riadok 303  function phpWebLogAnalyzer_get_id($table
Riadok 310  function phpWebLogAnalyzer_get_id($table
          */           */
   
         // if (!isset($value) || !isset($table)) return 0;          // if (!isset($value) || !isset($table)) return 0;
         if (!$value || !$table) return 0;          if (!$value || !$table)
                   return 0;
   
         global $phpWebLogAnalyzer_db_handle;          global $phpWebLogAnalyzer_db_handle;
         phpWebLogAnalyzer_check_db_handle();          phpWebLogAnalyzer_check_db_handle();
Riadok 330  function phpWebLogAnalyzer_get_id($table
Riadok 338  function phpWebLogAnalyzer_get_id($table
 }  }
   
 /*  /*
    * phpWebLogAnalyzer_get_session_id()
    *
    * Returns session_id according to $remote_addr_id and $http_user_agent_id
    * and session timeout defined in config.inc.php file.
    */
   function phpWebLogAnalyzer_get_session_id(
                   $remote_addr_id, $http_user_agent_id) {
   
           global $phpWebLogAnalyzer_SESSION_TIMEOUT;
           global $phpWebLogAnalyzer_db_handle;
           phpWebLogAnalyzer_check_db_handle();
   
           $query = "select"
                   ." id, session_id,"
                   ." unix_timestamp(now()) - unix_timestamp(datetime) as diff_sec"
                   ." from weblog_accesses"
                   ." where remote_addr_id = '$remote_addr_id'"
                   ." and http_user_agent_id = '$http_user_agent_id'"
                   ." order by datetime desc"
                   ." limit 1";
   
           $result = @mysql_query($query, $phpWebLogAnalyzer_db_handle)
                   or phpWebLogAnalyzer_db_error();
   
           if (($row = @mysql_fetch_array($result, MYSQL_ASSOC))
                           && ($row[diff_sec] < $phpWebLogAnalyzer_SESSION_TIMEOUT)
                           && ($row[session_id])) {
   
                   return $row[session_id];
           }
   
           //echo "if: ". $row[diff_sec] . " &lt; "
           //      . $phpWebLogAnalyzer_SESSION_TIMEOUT . "<br>";
   
           $query = "select max(session_id) + 1 as new_session_id"
                   ." from weblog_accesses";
   
           $result = @mysql_query($query, $phpWebLogAnalyzer_db_handle)
                   or phpWebLogAnalyzer_db_error();
   
           if (($row = @mysql_fetch_array($result, MYSQL_ASSOC))
                           && ($row[new_session_id])) {
   
                   return $row[new_session_id];
           }
   
           return 1;
   }
   
   /*
    * phpWebLogAnalyzer_get_sessions_count()
    *
    */
   function phpWebLogAnalyzer_get_sessions_count($ar = '') {
   
           global $phpWebLogAnalyzer_db_handle;
           phpWebLogAnalyzer_check_db_handle();
   
           $list_tables = '';
           $list_where = '';
   
           if (is_array($ar)) {
                   $names = array(
                                   'id' => array(
                                           'column' => 'id_id'),
                                   'datetime' => array(
                                           'column' => 'datetime_id'),
                                   'value' => array(
                                           'column' => 'value_id',
                                           'table' => 'weblog_values'),
                                   'request_method' => array(
                                           'column' => 'request_method_id',
                                           'table' => 'weblog_request_methods'),
                                   'query_string' => array(
                                           'column' => 'query_string_id',
                                           'table' => 'weblog_query_strings'),
                                   'path_info' => array(
                                           'column' => 'path_info_id',
                                           'table' => 'weblog_path_infos'),
                                   'path_translated' => array(
                                           'column' => 'path_translated_id',
                                           'table' => 'weblog_paths_translated'),
                                   'content_type' => array(
                                           'column' => 'content_type_id',
                                           'table' => 'weblog_content_types'),
                                   'content_length' => array(
                                                   'column' => 'content_length'),
                                   'script_name' => array(
                                                   'column' => 'script_name_id',
                                                   'table' => 'weblog_script_names'),
                                   'server_name' => array(
                                                   'column' => 'server_name_id',
                                                   'table' => 'weblog_server_names'),
                                   'server_port' => array(
                                                   'column' => 'server_port'),
                                   'server_software' => array(
                                                   'column' => 'server_software_id',
                                                   'table' => 'weblog_server_softwares'),
                                   'server_protocol' => array(
                                                   'column' => 'server_protocol_id',
                                                   'table' => 'weblog_server_protocols'),
                                   'gateway_interface' => array(
                                                   'column' => 'gateway_interface_id',
                                                   'table' => 'weblog_gateway_interfaces'),
                                   'proxy_addr' => array(
                                                   'column' => 'proxy_addr_id',
                                                   'table' => 'weblog_remote_addrs'),
                                   'proxy_host' => array(
                                                   'column' => 'proxy_host_id',
                                                   'table' => 'weblog_remote_hosts'),
                                   'remote_addr' => array(
                                                   'column' => 'remote_addr_id',
                                                   'table' => 'weblog_remote_addrs'),
                                   'remote_host' => array(
                                                   'column' => 'remote_host_id',
                                                   'table' => 'weblog_remote_hosts'),
                                   'remote_port' => array(
                                                   'column' => 'remote_port_id'),
                                   'auth_type' => array(
                                                   'column' => 'auth_type_id',
                                                   'table' => 'weblog_auth_types'),
                                   'remote_user' => array(
                                                   'column' => 'remote_user_id',
                                                   'table' => 'weblog_remote_users'),
                                   'remote_ident' => array(
                                                   'column' => 'remote_ident_id',
                                                   'table' => 'weblog_remote_idents'),
                                   'document_root' => array(
                                                   'column' => 'document_root_id',
                                                   'table' => 'weblog_document_roots'),
                                   'http_accept' => array(
                                                   'column' => 'http_accept_id',
                                                   'table' => 'weblog_http_accepts'),
                                   'http_accept_charset' => array(
                                                   'column' => 'http_accept_charset_id',
                                                   'table' => 'weblog_http_accept_charsets'),
                                   'http_accept_encoding' => array(
                                                   'column' => 'http_accept_encoding_id',
                                                   'table' => 'weblog_http_accept_encodings'),
                                   'http_accept_language' => array(
                                                   'column' => 'http_accept_language_id',
                                                   'table' => 'weblog_http_accept_languages'),
                                   'http_connection' => array(
                                                   'column' => 'http_connection_id',
                                                   'table' => 'weblog_http_connections'),
                                   'http_host' => array(
                                                   'column' => 'http_host_id',
                                                   'table' => 'weblog_http_hosts'),
                                   'http_referer' => array(
                                                   'column' => 'http_referer_id',
                                                   'table' => 'weblog_http_referers'),
                                   'http_user_agent' => array(
                                                   'column' => 'http_user_agent_id',
                                                   'table' => 'weblog_http_user_agents'),
                                   'script_filename' => array(
                                                   'column' => 'script_filename_id',
                                                   'table' => 'weblog_script_filenames'),
                                   'server_admin' => array(
                                                   'column' => 'server_admin_id',
                                                   'table' => 'weblog_server_admins'),
                                   'server_signature' => array(
                                                   'column' => 'server_signature_id',
                                                   'table' => 'weblog_server_signatures'),
                                   'request_uri' => array(
                                                   'column' => 'request_uri_id',
                                                   'table' => 'weblog_request_uris'),
                                   'ident_username' => array(
                                                   'column' => 'ident_username_id',
                                                   'table' => 'weblog_ident_usernames'),
                                   'ident_ostype' => array(
                                                   'column' => 'ident_ostype_id',
                                                   'table' => 'weblog_ident_ostypes'),
                                   'session' => array(
                                                   'column' => 'session_id',
                                                   'table' => 'weblog_sessions'),
                                   );
   
                                   global $phpWebLogAnalyzer_LOG_TABLE;
   
                                   $count = 0;
   
                                   foreach ($ar as $key => $val) {
                                           $count++;
   
                                           if (isset($names[$key][table])) {
                                                   $list_where .= "$phpWebLogAnalyzer_LOG_TABLE."
                                                           . $names[$key][column] . " = "
                                                           . $names[$key][table] . ".id and "
                                                           . $names[$key][table] . ".value like '$val'";
   
                                                   $list_tables .= $names[$key][table];
   
                                                   if ($count < count($ar))
                                                           $list_tables .= ', ';
                                           }
                                           else {
                                                   $list_where .= $names[$key] . " = '$val'";
                                           }
   
                                           if ($count < count($ar))
                                                   $list_where .= ' and ';
                                   }
           }
   
           $query = "select"
                   ." count(distinct session_id) as sessions_count"
                   ." from weblog_accesses";
   
           if (strlen($list_tables) > 0)
                   $query .= ", " . $list_tables;
   
           if (strlen($list_where) > 0)
                   $query .= " where " . $list_where;
   
           //echo "<p>$query<hr>";
   
           $result = @mysql_query($query, $phpWebLogAnalyzer_db_handle)
                   or phpWebLogAnalyzer_db_error();
   
           if ($row = @mysql_fetch_array($result, MYSQL_ASSOC))
                   return $row[sessions_count];
   
           return false;
   }
   
   /*
  * phpWebLogAnalyzer_db_error()   * phpWebLogAnalyzer_db_error()
  *   *
  * Database error handling function.   * Database error handling function.
  */   */
 function phpWebLogAnalyzer_db_error() {  function phpWebLogAnalyzer_db_error() {
         phpWebLogAnalyzer_db_error("error during work with database server");          return phpWebLogAnalyzer_error("error during work with database server");
 }  }
   
   

Legend:
Odstranené z verzie1.8  
zmenené riadky
  Pridané vo verzii1.9

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