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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.