Changeset 7126


Ignore:
Timestamp:
08/29/12 14:12:16 (7 years ago)
Author:
angelo
Message:

Ticket #3075 - Corrigir tamanho de tabela de logs do Expresso

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/header.session.inc.php

    r6801 r7126  
    2626if (isset($GLOBALS['phpgw']) && !isset($_SESSION['connection_db_info'])){  
    2727        $_SESSION['phpgw_info']['admin']['server']['sessions_checkip'] = $GLOBALS['phpgw_info']['server']['sessions_checkip']; 
    28         if($GLOBALS['phpgw_info']['server']['use_https'] == 1) {  
    29                 $new_ip = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR']."," : ""). $_SERVER['REMOTE_ADDR'];  
    30                 $GLOBALS['phpgw']->db->query("UPDATE phpgw_access_log SET ip='$new_ip' WHERE account_id <> 0 and lo = 0 and sessionid='{$GLOBALS['sessionid']}'",__LINE__,__FILE__);  
     28        if($GLOBALS['phpgw_info']['server']['use_https'] == 1){  
     29                $new_ip = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR']."," : ""). $_SERVER['REMOTE_ADDR'];                
     30                if(strlen($new_ip)>30){ 
     31                        $ip_exploded = explode(",",$new_ip); 
     32                        $new_ip = ""; 
     33                        for($i=0;$i<2;$i++) 
     34                                $new_ip .= isset($ip_exploded[$i])?(($i==1?",":"").trim($ip_exploded[$i])):(""); 
     35                        if(strlen($new_ip)>30) 
     36                                $new_ip = $ip_exploded[0]; 
     37                }                
     38                $GLOBALS['phpgw']->db->query("UPDATE phpgw_access_log SET ip='$new_ip' WHERE account_id <> 0 and lo = 0 and sessionid='{$GLOBALS['sessionid']}'",__LINE__,__FILE__); 
    3139        }  
    3240         $GLOBALS['phpgw']->db->query("select trim(sessionid),".($_SESSION['phpgw_info']['admin']['server']['sessions_checkip'] ? "ip," : "")."browser from phpgw_access_log where account_id <> 0 and lo = 0 and sessionid='{$GLOBALS['sessionid']}' limit 1",__LINE__,__FILE__);  
Note: See TracChangeset for help on using the changeset viewer.