hello,
i am new to web development and i am currently using mysql and php to make a site. based on your experience, should i add a field to my user table for the ip address when they register? if so, what should the data type be? length? etc.? i've seen varchar(15) from some readings, is that okay?
also, should i have another field for the most recent ip address in the login form? what is the advantage/disadvantage with this?
thanks for the guidance!
Adding a field for IP address
Moderator: General Moderators
-
ninethousandfeet
- Forum Contributor
- Posts: 130
- Joined: Tue Mar 10, 2009 4:56 pm
Re: Adding a field for IP address
It not something you "should" do. You can, if you want. But since you ask about the advantage/disadvantage, I assume you don't have a direct need for it.
If you store the IP, you can either use an integer (after ip2long) or just a string (varchar), doesn't matter. Maybe a string is better with IPv6 in mind.
If you store the IP, you can either use an integer (after ip2long) or just a string (varchar), doesn't matter. Maybe a string is better with IPv6 in mind.
-
ninethousandfeet
- Forum Contributor
- Posts: 130
- Joined: Tue Mar 10, 2009 4:56 pm
Re: Adding a field for IP address
sounds good. i didn't know if it were something that you should do or not. thanks for the advice.