Question

I'm building a website with xhtml, css, jquery, php and mysql. In one of the webpages, I have given the option to the user to vote - there is a like and dislike button on the page, and when the user clicks the LIKE/ DISLIKE button, the counter corresponding to that item is incremented/ decremented in the database correspondingly, and then the net count is displayed beside the LIKE/DISLIKE button for that item.

Something like this:

Net Rating: 21
Like   Dislike

Now, I would like to restrict the user entry, so that the user may click on the like/dislike button only once. They should not be allowed to keep clicking the like/dislike button and thus affect the count. I understand that this can be restricted by using user accounts through registration of the user and then probably using the session/cookies to monitor user activity, but then I am looking for a simpler solution which does not use session/cookies/user-registration.

Something like - capture current IP of the user, see if this IP has voted, if yes enable restriction. If this seems to be a good logic, please let me know how to capture the ip and then restrict - using jquery/php/any other technology.

Note- i use wamp (apache server with php)

thanks!

Was it helpful?

Solution

IP is a bad idea because DHCP allows users to change IPs, and OTHO many users have the same IP in an enterprise network... You could implement this by setting an "hasVoted" cookie on the client. Of course, this is a very weak security, but it is simple and might suit your needs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top