Forum Moderators: coopster
You can request a static IP from your ISP. They usually charge extra monthly charges for static IP addresses.
>>is there a way to detect whether the ip is dynamic or not?
No.
Another concern for you by using this technique...
Company A has a router in place which is doing Network Address Translation. Now you have 500 people in Company A with the same IP address because every external request is given the same IP address by the router. An external request is a web site request going outside the company network, through the router over the internet to your web site. How will you ever differentiate by IP address? You can't.
Your best option outside of a cookie would be to authenticate the user on any new visit to your site.
Some homes are also extended family - a pre-teen or two, perhaps multiple teens and 2 or more generations of adults present in a single home, sharing a single static IP. Do you really wanna autolog someone in from that house based solely on the IP match?
I wouldn't, but maybe that's just me.
You might want to look into how the normal authorization works (for apache at least), I know once I login I don't have to re-login until I restart the browser. I'd assume it uses sessions, but not entirely sure. I know it doesn't use a cookie.
Instead of an I.P. address, you could store the username plus hashed password in the cookie or something, and 'auto-login' the user when they visit the site, if you get my meaning.
I once saw a french thing that actually used a machine's mach address. It involved downloading softawre onto the user's machine, but it looked pretty bomb proof.