Trekky1700 Posted July 12, 2010 Share Posted July 12, 2010 Hi all, I'm having some trouble with a website I'm making. I want to add a button that users (logged in or not) can click to increase the score of a piece of content. How would I make it so that each person can only push the button once? Would I have to use cookies? Quote Link to comment Share on other sites More sharing options...
radar Posted July 12, 2010 Share Posted July 12, 2010 Something like that would need to be done using cookies if you want to allow guests the ability to press that button only one time. But there is always the people out there like me, who clear out their cookies daily. So it wouldn't prevent someone like me, from pressing that button twice. Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 12, 2010 Share Posted July 12, 2010 Cookies are stored on users' side, and as such can be modified to allow more clicks. You should use some kind of server-side persistence (sessions, database) Quote Link to comment Share on other sites More sharing options...
Alex Posted July 12, 2010 Share Posted July 12, 2010 Using cookies would not be effective at all. You could just set your browser not to store cookies and press the button as many times as you want. There will be no method that will work perfectly for something like this. If you use cookies they can be cleared. If you base it on ip address they can use a proxy. If you use sessions they can just restart their browser and the session is cleared from the web server, etc.. The best way would be to require registration so that they can click only one time per account, but if you're in a situation where you need to allow guests then I'd say the next best thing is to go off ip address, or perhaps even a combination of the methods mentioned above. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.