Page 1 of 1

Log users ip/use it to block them for length of time

Posted: Wed Oct 22, 2003 10:25 pm
by decoy1
I would like to be able to log a visitors IP address after submitting a form. Then associate the current time with the IP address when it was logged and not allow that particular address to submit the same form again for 24 hours.

I can get the IP and know how to get the current time obviously, but I'm struggling to find the best way to do this. I have a couple of ideas but they seem overly complicated.

I'm already setting a cookie when a visitor initially visits otherwise I would set a cookie with the current time.

Was wondering if someone might offer me some suggestions.

Thanks

Posted: Wed Oct 22, 2003 11:51 pm
by volka
do you have a database at hand?
if so you might store the ip and a timestamp. When the form is submitted you query the recordset(s) having the ip and a timestamp within a certain timespan. If there is such a record you block the submission. If not the request is accepted and the new timestamp is updated/inserted.

Posted: Wed Oct 22, 2003 11:55 pm
by Gen-ik
Don't forget that some ISPs change their users IP address everytime that person connects to the web. Someone visiting your site might not have the same IP address next time they visit.