php - Disable Link Onclick -
possible duplicate:
reddit-style voting button
so have been working on site, wanted create stackoverflow/reddit style voting system site. want disable link when user clicks on won't able vote twice. here code have:
<a href="#" title="upvote" class="arrows" onclick ="submitvote(<?php echo $lulz['link_id']; ?>, 1); return false;">↑</a> i need keep current on-click function can add in vote. possible add disable (with cookies).
people can cheat if use cookies. can delete cookie, they'll able vote many times they're willing delete cookie. it's better store info on server in addition setting cookie. if security isn't important , want use cookie, set cookie @ end of submitvote(). @ beginning of submitvote(), cookie first. if exists, don't send vote server. can use alert() tell user can't vote twice. if doesn't exist, submit vote server , add cookie after.
Comments
Post a Comment