Location: PHPKode > projects > phpCAMALEO > common/fun2inc/get_port.inc
<?PHP
if(!function_exists('get_port'))
{
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	# Get system ip/port 
	#
	function get_port($type)
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	{
		$type=strtolower($type);
		if($type=='ip' || $type=='all')
		{
			### if(isset($_SERVER[HTTP_X_FORWARDED_FOR])) { $ip=$_SERVER[HTTP_X_FORWARDED_FOR]; } else { $ip=$_SERVER[REMOTE_ADDR]; }
			$ip=$_SERVER[REMOTE_ADDR];
		}
		#
		if($type=='port' || $type=='all')	{ $port=$_SERVER[REMOTE_PORT]; }
		if($port=='') 						{ $port='N/A'; }
		#
		if($type=='ip' || $type=='all')		{ $temp=$ip; }
		if($type=='all')					{ $temp.=':'; }
		if($type=='port' || $type=='all')	{ $temp.=$port; }
		#
		return($temp);
	}
}
?>
Return current item: phpCAMALEO