Chrisj Posted June 29, 2009 Share Posted June 29, 2009 I'm using a php script for my web site which has registration, log-in, etc. Can you tell me how I might be able to capture the registrants IP adress upon registration? Thanks. Link to comment https://forums.phpfreaks.com/topic/164100-capturing-ip-addreess/ Share on other sites More sharing options...
Maq Posted June 29, 2009 Share Posted June 29, 2009 $_SERVER['REMOTE_ADDR']. Link to comment https://forums.phpfreaks.com/topic/164100-capturing-ip-addreess/#findComment-865646 Share on other sites More sharing options...
Chrisj Posted June 29, 2009 Author Share Posted June 29, 2009 Thanks for your reply. If I add $ip = $_SERVER[REMOTE_ADDR]; to my registration page and add a corresponding field in my database, this will allow me to capture the IP address of the regisrtant? Should the db field be named REMOTE_ADDR ? Obviously I could use some more information. Any additional enlightening would be appreciated. Link to comment https://forums.phpfreaks.com/topic/164100-capturing-ip-addreess/#findComment-865729 Share on other sites More sharing options...
Maq Posted June 29, 2009 Share Posted June 29, 2009 You can name it whatever you want, something that's logical. Remember when you store these values in the database to use these two functions INET_ATON() and INET_NTOA(). One is for inserting the IP and one is for extracting it. Storing IP's as pure VARCHARs would restrict you in certain functionality. Good luck. Link to comment https://forums.phpfreaks.com/topic/164100-capturing-ip-addreess/#findComment-865732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.