Hey guys,

I have created a website that has a like feature. Every time someone clicks on the button it writes to my database and adds / removes a row (depending on if the user is liking or disliking the content).

Basically I want to stop a user from "spamming" the button. Maybe do something like, display an alert when they click the DIV 5 times within 1 second. Preferably in jQuery/Javascript?

Thanks!

If you require the user to login, then you can also capture hte user name and track the number of times the user has voted.

Without a username, you could just track it by the session ID, if you do not care how many times the same user can revisit the site and re-vote.

displaying an alert is not going to prevent the user from spamming you. All they need to do is click OK once the alert pops-up, and even if you disable the feature after the nth click, they can just re-load the page and continue the "click-spamming".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.