tsilenzio Posted December 31, 2007 Share Posted December 31, 2007 First off, I tried to search for this but failed in that attempt. I want to make a site that requires a user to login. If you are a registered user u can choose to login with ether your login name, or [for more security purposes] with your email address... I was going to store their IP address inside a database along with the option they chose but then I realized "What if the user has dail-up [or Dynamic IP for their means of using the internet] and their IP changes every time they go to the website?" [My temp-solution]: As of right now I am only using sessions, I wasn't sure if i would need to use cookies to keep track of the user, or if there were other ways? Any ideas or help would be much much appreciated Also, just a side question.. is the use of Sessions AND Cookies a bad combination? (Some things I cannot put inside cookies such as credit-card numbers and so on..) Quote Link to comment https://forums.phpfreaks.com/topic/83817-solved-dynamic-ip-tracking/ Share on other sites More sharing options...
shocker-z Posted December 31, 2007 Share Posted December 31, 2007 The only way i can think of doing this is if you were to get the hostname instead of the IP addrews and parse it to a certain point of the address for example.. cpc2-basf1-0-0-cust826.nott.cable.ntl.com So i would put this in the database nott.cable.ntl.com in the databvase to match my current connection and this will generally stay the same even when IP is renewed, different ISPs parse or seperate in different ways so you will have to play with the best way of seperating. If you are uk based and evero0ne that logs in is uk based then you could have a look at the most common ISP's and create a lis of them and parse based on that e.g. if ntl then select the last 4 exploded values when exploding by a fullstop Hope i have given you some kind of idea to work on. have a look at http://uk3.php.net/gethostbyaddr Regards Liam Quote Link to comment https://forums.phpfreaks.com/topic/83817-solved-dynamic-ip-tracking/#findComment-426647 Share on other sites More sharing options...
aosmith Posted December 31, 2007 Share Posted December 31, 2007 what about creating a random hash storing it to a db and then storing it in a cookie as well? Quote Link to comment https://forums.phpfreaks.com/topic/83817-solved-dynamic-ip-tracking/#findComment-426678 Share on other sites More sharing options...
tsilenzio Posted January 1, 2008 Author Share Posted January 1, 2008 I had one idea, was store a tracking number in a cookie and add the settings of the cookies tracking number to the database with the option of yes use email to login, or no use user name, and set the cookie to expire every month.. or never (but of course it will eventually get deleted Note: This method requires daily manual garbage collection of deletion of the tracking numbers in the database for users who's cookie has expired (This way u don't keep saving a bunch of useless information) Quote Link to comment https://forums.phpfreaks.com/topic/83817-solved-dynamic-ip-tracking/#findComment-427098 Share on other sites More sharing options...
teng84 Posted January 1, 2008 Share Posted January 1, 2008 sorry this is not clear enough for me what do you exactly want to do? Quote Link to comment https://forums.phpfreaks.com/topic/83817-solved-dynamic-ip-tracking/#findComment-427101 Share on other sites More sharing options...
tsilenzio Posted January 1, 2008 Author Share Posted January 1, 2008 Okay sorry ill explain in better terms.. I have seen this used on some sites too, just never played with it.. The Story: I want to make a content system that our whole town would use (school, restaurants so on..) For some important users like the mayor, I want them to have the option to use their username OR email to login, but they have pick one or the other [using a email to login gives more security and makes it a little harder to hack into] The Idea: I was going to store their option in the database by using their IP Address to identify who they are (since I need to decide if they are logging in by username or email BEFORE they login).. The Problem: Alot of the people around here have dail-up and due to that their IPs are never the same.. Thus causing the storing of IPs to be useless as to the fact that any IPs stored wont be used ever again by the same person Quote Link to comment https://forums.phpfreaks.com/topic/83817-solved-dynamic-ip-tracking/#findComment-427113 Share on other sites More sharing options...
teng84 Posted January 1, 2008 Share Posted January 1, 2008 to recognize a person you cant use IP's i never heard of someone uses ip as to determine the users.. like you said theres is no better way than email address or username? Quote Link to comment https://forums.phpfreaks.com/topic/83817-solved-dynamic-ip-tracking/#findComment-427118 Share on other sites More sharing options...
tsilenzio Posted January 1, 2008 Author Share Posted January 1, 2008 never mind i got a way to do it! =] Quote Link to comment https://forums.phpfreaks.com/topic/83817-solved-dynamic-ip-tracking/#findComment-427126 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.