Welcome Guest, Not a member yet? Register   Sign In
Only allow form submission once every X seconds?
#1

[eluser]gh0st[/eluser]
Does anyone know where I can find ignited code that would only allow form submissions once every X seconds, and stores the value in either Cookie, Session or Database?

I'm wanting it so that you can only press submit on a form once every 90 seconds.

I'm not sure exactly what such a system is called.

Thanks.
#2

[eluser]Phil Sturgeon[/eluser]
Quote:I’m wanting it so that you can only press submit on a form once every 90 seconds.

Does this mean the submit form should be disabled (greyed out and unclickable) during this time, or should the form just return a message saying "you may only submit this form once every 90 seconds" like it does on these forums if you search too often?

If you want the submit button to be disabled, that is primarily a JavaScript related issue.

Otherwise, on submit success use $this->session->set_userdata('form_posted', time()); then do a comparison against that time on each submit to see if they should be allowed or not.
#3

[eluser]Dam1an[/eluser]
I would go with the server side method of storing the submit time in the session and comparing it, as you can easily get around any client side validation using good old firebug




Theme © iAndrew 2016 - Forum software by © MyBB