Reputation: 11
I want to stop a user from clicking a Like button multiple times. I can disable the button on the first click using jQuery, but when the page is refreshed, the user can again click the button. How do I prevent a user from re-clicking the button on page refresh?
Upvotes: 1
Views: 214
Reputation: 12725
You should check it in Server side. use can use $_SESSION for this purpose. When user click on link set
$_SESSION['liked']=true;
and then check if user clicked before. Session won't be destroyed in when page refreshed.
Upvotes: 0
Reputation: 1491
use js to block the UI
like so: http://www.malsup.com/jquery/block/#demos
google "js block ui"
sorry for the short answer
edit: did not read your question properly i guess, see Mayank swami's post , he has your answer
Upvotes: 0
Reputation: 57312
you can store the user id in database who have already liked and disable the like button/link for them so they once click on the button or link never click again
Upvotes: 3