[nflug] Logging IP Address to Database

Daniel Colascione dan.colascione at gmail.com
Sun Aug 24 01:12:25 EDT 2008


On Aug 23, 2008, at 12:20 AM, Robert Wolfe wrote:
> What I want to do is once a user clicks on the “Send” button to send  
> their login credentials, I want it to log the IP that they are  
> connecting from to the MySQL database entry that has their  
> information in it.  My question is is how do I do this?  Browser and  
> OS information would be cool to log, too, for statistical purposes.
>
That depends on your front-end language, not your specific database  
back-end. Any web environment will give you access to the standard CGI  
environment variables (or emulations thereof). See the CGI  
specification:

http://hoohoo.ncsa.uiuc.edu/cgi/env.html

You'll find all the information you need there. (REMOTE_HOST for IP;  
HTTP_USER_AGENT for browser/OS.)

For statistical work, though, you're better off using something like  
webalyzer with your web server's access logs. It works well enough,  
and without any additional work on your part.

Also, the IP address doesn't actually *mean* anything. It could by  
dynamic. It could be a proxy. Who knows? It's not good for  
authentication even for a single session; AOL users, for example, get  
bounced around to a dozen different proxies over the course of the  
same session. IMHO, recording an IP address is near-useless.

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in email?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.nflug.org/pipermail/nflug/attachments/20080824/57e93202/attachment.html


More information about the nflug mailing list