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
Log users ip/use it to block them for length of time
Moderator: General Moderators
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.
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.