i have a voting system that you dont have to login to and i want to know how i can set it to where they can vote once per day, either by blocking IP or something of the sort. i prefer not to have a database
<script type="text/javascript">
var clicks = 0;
function linkClick(){
document.getElementById('clicked').value = ++clicks;
}
document.write('<a href="#" onclick="linkClick()">Vote Now!</a>');
$('#clicked').parent().bind('click', function(evt) {
$(this).unbind('click');
/* do long time task....
evt.preventDefault();
});
</script>
You have clicked the link <input id="clicked" size="3" onfocus="this.blur();" value="0" > times
this code as it stands will only let a use vote once and only once, i would like it to be every 24 hours and in html, thank you in advance
You could create a cookie and check that each day to see if they have voted already. Although JCO611 is correct, this is easily bypassed. I would recommend using some server side code.
For more on cookies in javascript: http://www.quirksmode.org/js/cookies.html