Jump to content

how to limit the number of times an action can be made.


Pacopag

Recommended Posts

Hi.

I'm running a photo contest where viewers vote on the photos.  Right now I'm limiting the number of votes to 2 per ip address, per day.  But I'm worried that some people will know how to change their ip address and vote many more than twice per day.

 

Does anyone know of a good way to do something like this?  I want each unique visitor to be able to vote on each picture only twice per day.

 

Thanks,

Link to comment
Share on other sites

The voters are not necessarily registered users.  I suppose I could create a session variable for each visitor, but wouldn't that get destroyed if they just reset their computer?

 

I was thinking maybe writing their ip and machine name to a db to use as a unique id, but I'm not sure how to get the machine name.  I think that gethostbyaddr() might work, but I read that it only works on Windows.

 

Is there any other info about the visitor that I could retrieve that would identify them as unique?

Link to comment
Share on other sites

One option for anonymous users is to gather user information and use COOKIE, but this is not very consistent either since cookies can be manipulated or emptied. Another option could be to gather data from anonymous users like user_agent, ip etc. and create profile for them based on this information to database, but its not even close to bullet proof either.

 

If you use sessions, the session will be destroyed when the user closes his browser, unless you again save it somewhere (file/db). And the same problem comes again: how to separate anonymous users from each other.

Link to comment
Share on other sites

When I do

 

echo(gethostbyaddr($_SERVER['REMOTE_ADDR']));

 

I get some kind of key followed by what looks like a domain related to my isp.  What exactly is this, and how uniquely does this identify the client?  Can this be easily changed by the client user?

 

Also, how would I use session ids to do what I'm trying to do?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.