= $min) && (ip2long($ip) <= $max)) return false; } return true; } else { return false; } } function getip() { if ($this->validip($_SERVER["HTTP_CLIENT_IP"])) { return $_SERVER["HTTP_CLIENT_IP"]; } foreach (explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]) as $ip) if ($this->validip(trim($ip))) return $ip; if ($this->validip($_SERVER["HTTP_X_FORWARDED"])) return $_SERVER["HTTP_X_FORWARDED"]; elseif ($this->validip($_SERVER["HTTP_FORWARDED_FOR"])) return $_SERVER["HTTP_FORWARDED_FOR"]; elseif ($this->validip($_SERVER["HTTP_FORWARDED"])) return $_SERVER["HTTP_FORWARDED"]; elseif ($this->validip($_SERVER["HTTP_X_FORWARDED"])) return $_SERVER["HTTP_X_FORWARDED"]; else return $_SERVER["REMOTE_ADDR"]; } function display($tpl = null) { $document = & JFactory::getDocument(); if (JRequest::getVar('about')) { $this->setLayout('about'); } include_once(JPATH_BASE."/components/com_vxc/assets/iptocountry/Ip2Country.php"); $ipc = new Ip2Country(JPATH_BASE."/components/com_vxc/assets/iptocountry/ip2country.dat"); $resp = $ipc->lookup($this->getip()); $fromPeninsula = ($resp == "ES" || $resp=='PT' ); $this->assignRef('fromPeninsula',$fromPeninsula ); parent::display($tpl); } } ?>