I am trying to add this thing to my site, but I don't have a clue about how I might do it.... Essentially, I want to give people the chance to press a button on my site. These people will just be "naked" visitors and will not have an account on my website. When they press this button, I will just process something in the backend of my site... but they cannot press the button again. How would you do this? Rich
session variables that stores the (true) if they pushed and false if not, and then it showa or not the button.
Thanks for the reply! But wud the session var stay even if the user clicked off the site then back onto it?
Yes but how would you stop the button showing up for the same person even when they go off the site and come back
$_SESSION? No! The value would be lost when the session expired. Also, using session for a site that does not requires login?! What for?! Disable the button onclick event? And if the user reloads the page? Cookies? And if the user cleans up the cookie? It is better to save in a database the IPs of who have clicked on the button. Then, every time the page is loaded, check if the IP has already clicked on it. If not yet, show the button. If yes, don't show it. Yes, the IP can change. But as the users won't have an account, you will have to rely on the IP.
Exactly, do it via database, save IP and if users are registered then usernames as well and don't show button to IPs which have been clicked the button.
Are you looking for this. Here I've made simple script to solve your problem. If you like it, just PM me, I'll sent whole the things. thanks
IP is the best way to do this but isn't foolproof, I guess it depends onthe application, would the user benefit from multiple clicks. i.e. make it worthwhile trying to circumvent the system or are the users trusted and no negative effects of multiple clicks
i think javascript can help u you can put it in the OnClick event for the particlular user whom you dont want to allow to click it