How can I get the user's IP
Moderator: General Moderators
-
GregArtemides
- Forum Newbie
- Posts: 5
- Joined: Fri Jun 13, 2003 7:03 pm
How can I get the user's IP
I'm looking for a way to get the ip address of users logging into my site, for security purposes. Is there a function in PHP that would do this? Does anyone have a script that would do this? I basically want to make sure that I know where a user is registering from, as a way of monitoring anauthorized users trying to sneek in. Any ideas? 
take a look at the members of $_SERVER at http://php.net/reserved.variables
Last edited by volka on Fri Jun 13, 2003 7:11 pm, edited 1 time in total.
If you need the IP address for security purposes I also recomend reading about HTTP_X_FORWARDED_FOR - it's a reserved variable for you real IP when someone is connecting through a proxy server. Then the REMOTE_ADDR will have the proxy's IP and HTTP_X_.... will have the "real" user. Read the PHP manual page which volka gave you and especially the user notes at the bottom.