8
Yet a bit different way,
// XOOPS Virtual Path (URL)
// Virtual path to your main XOOPS directory WITHOUT trailing slash
// Example: define('XOOPS_URL', 'http://localhost');
// auto change the host name for local or remote access
$itxx_local_host_ip = gethostbyname("FQDN"); // Use host name part only for win32
$itxx_user_ip = $_SERVER['REMOTE_ADDR'];
$itsl_pattern = "'(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})'";
$itsl_is_local = ((preg_replace($itsl_pattern,"\\1.\\2.\\3",$itxx_user_ip)==preg_replace($itsl_pattern,"\\1.\\2.\\3",$itxx_local_host_ip)))?true:false;
if ($itsl_is_local) {
define('XOOPS_URL', 'http://local.i.p.x');// use local ip 192.168.x.x
} else {
define('XOOPS_URL', 'http://www.itslbd.com');
}
?>
Hope this helps, Note: this is originally from sourceforge.