spamming on submit from
- Started
- Last post
- 10 Responses
- kinetic
i have a form that allows users to submit images (via PHP)...it inserts the record into a database and emails me the notification
users can keep hitting refresh on the submit page to spam the site...what's the best way to disable this from happening?
thanks :)
- scarabin0
i've seen javascript code that has a time limit between submits from one ip
try searching for that
- welded0
Ya, disable the field and/or check on the PHP end for multiple submits from the same IP and ignore any that are too close together. Some forum software do this this to prevent multi-posts.
- justjeff0
You could:
- Log the IP in the database, count the number of submissions from that IP in the last 24 hours before inserting/updating.
- Use a session variable that you set when you display the form, and unset as soon as its submitted the first time
- Calculate a hash of the image that's uploaded, and check the hash to see if that file has already been uploaded once before.
- Some combination of the above
- UndoUndo0
session variable is a very simple solution. Set a boolean once the form has been successfully submitted and the details captured
- kinetic0
users would have to have cookies enabled for session variables to work right?
- UndoUndo0
yes, if thats a problem grab their ip and store it in the db with a boolean. then do a check to see if they have submitted before on that date
- ldww0
function submitDisable(){
document.getElementById('orderbu... = 'true'
document.form.submit();
}
- ldww0
nt fucks up code... email me if you want the raw
- ldww0
oh wait i just realized the problem was not the submit button its the refresh button. just do a header('Location: thankyou.php'); to send them to another page
- kinetic0
not a bad idea
thanks all