how can i get the ip address of the user on my email while the user clicks the submit button anyone could help me

Recommended Answers

$ip = $_SERVER['REMOTE_ADDR'];
Jump to Post

You want the MAC address? That's impossible with PHP. The browser doesn't send that information.

Jump to Post

All 5 Replies

$ip = $_SERVER['REMOTE_ADDR'];

You want the MAC address? That's impossible with PHP. The browser doesn't send that information.

That what magicmedia told to get ip address of PC:-

$_SERVER['REMOTE_ADDR'];

It will return the ip address of the user connected.....

function get_real_ip_addr(){
		if (!empty($_SERVER['HTTP_CLIENT_IP'])){   //check ip from share internet
			$ip=$_SERVER['HTTP_CLIENT_IP'];
		}
		elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){   //to check ip is pass from proxy
			$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
		}
		else{
			$ip=$_SERVER['REMOTE_ADDR'];
		}
		return $ip;
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.