qubix Posted April 2, 2009 Share Posted April 2, 2009 Hi All I really hope that someone will be able to help me with a funny that I'm experiencing. I want to record the IP address of users that register for my website, the registration form's source shows the IP address of the visitor using the echo $_SERVER["REMOTE_ADDR"] in a hidden field called "ip_addr" My form also has a 'datesignup' function - that also shows me the date of the signup. In my table called Members - I obviously have a field called 'IP_ADDR' and its properties are: ip_addr VARCHAR(15) NOT NULL default '', My problem is, the IP address never gets recorded into my members table IP_Addr column, but the datesignup does get stored in the 'datesignup' column - so i know data is recorded. Has anyone ever experienced this before? I've hunted high and low and cannot find a resolution. Thanks in advance QUbix Quote Link to comment https://forums.phpfreaks.com/topic/152292-storing-ip-address/ Share on other sites More sharing options...
rhodesa Posted April 2, 2009 Share Posted April 2, 2009 first, why pass it as a hidden form element if you can just get it on form submission? what does the PHP code that does the INSERT look like? Quote Link to comment https://forums.phpfreaks.com/topic/152292-storing-ip-address/#findComment-799771 Share on other sites More sharing options...
Maq Posted April 2, 2009 Share Posted April 2, 2009 You should be storing it as an integer and calling INET_ATON on the IP in the query. What does your query look like? Quote Link to comment https://forums.phpfreaks.com/topic/152292-storing-ip-address/#findComment-799793 Share on other sites More sharing options...
thepip3r Posted April 2, 2009 Share Posted April 2, 2009 if your query is working and all other data besides the IP is being added into the database, then mysql doesn't see a problem with your query -- are u sure there's actual data in the $_POST, $_GET or $_SERVER variable you're passing to the section of mysql that is attempting to add the IP to your DB? echo out your sql statement and see if the var is showing a blank entry. Quote Link to comment https://forums.phpfreaks.com/topic/152292-storing-ip-address/#findComment-799799 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.