I have a soccer website that will have 6 little buttons that when clicked it will go through a random array and tell the user has won something, or not. What would be the best way to prevent the user from clicking several times until the user won. For example some kind of javascript to detect the users ip and check if it has been in the site in the pasted x hours.
Thanks,
JavaScript can’t detect your IP address. That is done when the webserver serves content to the browser.
You’d have to implement that functionality serverside (via PHP, etc.) and submit a
POSTrequest via JavaScript (AJAX) when the person clicks the button. If the person with that IP has submitted within a certain timeframe, then just send back a nasty message accusing the person of cheating 😉It’s virtually impossible to stop people from cheating, but that will thwart many of them.