Get real IP at University lan

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
imac
Forum Newbie
Posts: 6
Joined: Wed Jan 11, 2012 12:57 pm

Get real IP at University lan

Post by imac »

Hi

I have been using a fuction to get the IP of the visitoros until now.
Currently i am inside the college and i found out that the function always returned me 127.0.0.1

How can i get the real IP? It has to be possible as some other sites detects my real IP...

The function i am using is this one:

Code: Select all

public function getIP(){
		if(getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")){
			$ip = getenv("HTTP_CLIENT_IP");
		}
		elseif(getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")){
			$ip = getenv("HTTP_X_FORWARDED_FOR");
		}
		elseif(getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")){
			$ip = getenv("REMOTE_ADDR");
		}
		elseif(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")){

			$ip = $_SERVER['REMOTE_ADDR'];
		}
		else {
			$ip = "Unknown";
		}
		 
		return $ip;
	}
	

Thanks.
Doug G
Forum Contributor
Posts: 282
Joined: Sun Sep 09, 2007 6:27 pm

Re: Get real IP at University lan

Post by Doug G »

You probably won't be able to. Ask your lan network admins maybe.
nothing0829
Forum Newbie
Posts: 2
Joined: Tue Nov 08, 2011 7:23 pm

Re: Get real IP at University lan

Post by nothing0829 »

I should know more about it............
Post Reply