yandoo Posted June 10, 2013 Share Posted June 10, 2013 (edited) 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 June 10, 2013 by yandoo Quote Link to comment https://forums.phpfreaks.com/topic/278985-cookie-values-a-basic-understanding/ Share on other sites More sharing options...
yandoo Posted June 10, 2013 Author Share Posted June 10, 2013 Just a quick addition to the background... The voting/rating system is for books, so users can vote for more than one book but never the same one twice. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/278985-cookie-values-a-basic-understanding/#findComment-1435119 Share on other sites More sharing options...
AbraCadaver Posted June 10, 2013 Share Posted June 10, 2013 (edited) 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 June 10, 2013 by AbraCadaver Quote Link to comment https://forums.phpfreaks.com/topic/278985-cookie-values-a-basic-understanding/#findComment-1435152 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.