#61: Extracting Client Information
Webservers can extract information about their connecting clients by looking at TCP/IP status and HTTP headers. You can access the client's IP address and browser version fairly easily through PHP variables. However, like almost anything the client sends you, this information is completely useless for session tracking. IP addresses aren't unique because of proxies and Network Address Translation (NAT), and browser versions can be completely bogus.
This information is, however, good for finding basic statistics about your users. A few bogus headers here and there aren't going to matter if you're looking at 100,000 accesses.
The following function extracts an IP address. The first part is relatively simple, because ...
Get Wicked Cool PHP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.