IP Detection
This little snippet tries to get the IP-Address of the user: private function _detectIP(){ //Mage::log(‘_detectIP’, null, __CLASS__.’.log’, true); if (getenv(‘HTTP_CLIENT_IP’)) { $this->_ip = getenv(‘HTTP_CLIENT_IP’); Mage::log(‘Detected IP (getenv(\’HTTP_CLIENT_IP\’)):’, null, __CLASS__.’.log’, true); Mage::log($this->_ip, null, __CLASS__.’.log’, true); } elseif (getenv(‘HTTP_X_FORWARDED_FOR’)) { $ips = explode(‘,’, getenv(‘HTTP_X_FORWARDED_FOR’)); $this->_ip = (string)trim($ips[0]); } elseif (getenv(‘HTTP_X_FORWARDED’)) { $ips = explode(‘,’, getenv(‘HTTP_X_FORWARDED’)); $this->_ip = […]