Unique likes
Moderator: General Moderators
Unique likes
Looking for a little php help. I am currently developing a page not too different from 9gag. The idea behind it is that each unique visitor has an opportunity to "like" some kind of photo, video, etc. This "liking" thing has to be accessible not only to members, but also to those who are not registered. Each "vote or like" needs to be unique. I thought about having a table in my database matching every possible post "liked" with an ip address, so that every time a visitor opens a site, the script would find out what did he "like". Of course that would require iterating through every data entry in that table, so it is bugging me, whether it's a good approach. Is it?
Re: Unique likes
Sorry, if it's not advanced enough of a question, just didn't know where else to ask
Re: Unique likes
You could use indices on IP and story ID to make the lookup trivial. Doesn't solve the problem of one IP not necessarily equaling one user.
Re: Unique likes
Thanks for your answer. Is there some kind of unique machine id, to identify different pcs under the same ip address?
Re: Unique likes
You can use something like browser fingerprinting, which is kinda shady but will probably do what you're looking for. Much like one IP doesn't imply one user, neither does one computer necessarily mean one user.
You can have one or the other, but not both. Not reliably.This "liking" thing has to be accessible not only to members, but also to those who are not registered. Each "vote or like" needs to be unique.
Re: Unique likes
I did some googling on the whole subject. I guess it would be smarter to just stick to an IP address. It seems to be either impossible or too much of a hustle for a 9gag site.
Re: Unique likes
Can I use simple cookies to store arrays of what sort of posts each visitor liked? Would that help?
Re: Unique likes
No. Cookies can be cleared by the user.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Unique likes
You could pretty easily create a hash from the browser string and save it with the IP address. That would provide a little more identification of the computer, but not that much.Celauran wrote:You can use something like browser fingerprinting, which is kinda shady but will probably do what you're looking for. Much like one IP doesn't imply one user, neither does one computer necessarily mean one user.
(#10850)