Jump to content

Cookie Values - a basic understanding


yandoo

Recommended Posts

Hiya I'm a bit of a noob when it comes to working with cookies and have a basic question... The the background is that I am trying to build a voting system for my website with mysql & php.

 

As I understand in order to stop users from voting for the same item more than once I found i could either:

 

(1) Record the ip address with each vote (but I'm not sure this with limit multiple people who are behind a router with the same external ip address?)

(2) Require a user to login with email address (but some people wont be bothered with voting at all)

(3) Storing cookie information with each vote.

 

I've been looking at cookie guides and there's one thing that I just don't understand. When setting the cookie "Value", how is the value of the cookie initially taken?? I've read that "common values are username string and last date visit". But how would I get the username string without users logging in?? I need to get information that will uniquely identify each user. 

 

I'm sorry i must sound really stupid but if you could help me to understand that would be brilliant!

 

Thank you.

Edited by yandoo
Link to comment
Share on other sites

At its simplest, you can store book ids in an array in the cookie when they vote, but before they vote you check for the book id in the cookie.  If the book id exists in the cookie then they can't vote.

 

BTW, this is very easy to circumvent, either on purpose or by accident if a user clears their cookies.

Edited by AbraCadaver
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.