Changeset 16230


Ignore:
Timestamp:
2007/10/02 15:14:36 (16 years ago)
Author:
nanasess
Message:

$_SERVERREMOTE_HOST? が取得できない場合, $_SERVERREMOTE_ADDR? を取得するように修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/SC_Customer.php

    r16188 r16230  
    190190        $_SESSION['customer'] = $this->customer_data; 
    191191        // セッション情報の保存 
    192         GC_Utils_Ex::gfPrintLog("access : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH ); 
     192        GC_Utils_Ex::gfPrintLog("access : user=".$this->customer_data['customer_id'] ."\t"."ip=". $this->getRemoteHost(), CUSTOMER_LOG_PATH ); 
    193193    } 
    194194 
     
    198198        unset($_SESSION['customer']); 
    199199        // ログに記録する 
    200         GC_Utils_Ex::gfPrintLog("logout : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH ); 
     200        GC_Utils_Ex::gfPrintLog("logout : user=".$this->customer_data['customer_id'] ."\t"."ip=". $this->getRemoteHost(), CUSTOMER_LOG_PATH ); 
    201201    } 
    202202 
     
    250250        return false; 
    251251    } 
     252 
     253    /** 
     254     * $_SERVER['REMOTE_HOST'] または $_SERVER['REMOTE_ADDR'] を返す. 
     255     * 
     256     * $_SERVER['REMOTE_HOST'] が取得できない場合は $_SERVER['REMOTE_ADDR'] 
     257     * を返す. 
     258     * 
     259     * @return string $_SERVER['REMOTE_HOST'] 又は $_SERVER['REMOTE_ADDR']の文字列 
     260     */ 
     261    function getRemoteHost() { 
     262 
     263        if (!empty($_SERVER['REMOTE_HOST'])) { 
     264            return $_SERVER['REMOTE_HOST']; 
     265        } elseif (!empty($_SERVER['REMOTE_ADDR'])) { 
     266            return $_SERVER['REMOTE_ADDR']; 
     267        } else { 
     268            return ""; 
     269        } 
     270    } 
    252271} 
    253272?> 
Note: See TracChangeset for help on using the changeset viewer.