I have a php page where students from the school are logging on via their iPads.. I need to log their IP addresses in the process (for record keeping for the school) but they all have the same IP address with the method I’m using:
if (getenv(HTTP_X_FORWARDED_FOR)) {
$ipaddress = getenv(HTTP_X_FORWARDED_FOR);
} else {
$ipaddress = getenv(REMOTE_ADDR);
}
What is a more in depth IP address that I can obtain that would be unique to each iPad?
That’s the reality of networking. The only proven address you can get is
$_SERVER['REMOTE-ADDR'], since that’s the one negotiated in the TCP/IP handshake. And this address may just be that of a router, proxy, NAT device or something else which you cannot “see beyond”. Anything else in the HTTP headers is completely unprovable, unreliable and easy to spoof.IP addresses simply cannot be guaranteed or expected to be unique or “real”, unless you are in full control and have full knowledge of the network between the client and your server.
That’s because IP-based, packet switched networks are designed for the purpose of reliably delivering data from one node on the network to another. IP addresses are an implementation detail of that. Neither are designed for the purpose of unique identification.