PHP Developers Network
http://forums.devnetwork.net/

Unique likes
http://forums.devnetwork.net/viewtopic.php?f=19&t=141163
Page 1 of 1

Author:  justas28 [ Tue Apr 07, 2015 4:00 pm ]
Post subject:  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?

Author:  justas28 [ Tue Apr 07, 2015 4:08 pm ]
Post subject:  Re: Unique likes

Sorry, if it's not advanced enough of a question, just didn't know where else to ask

Author:  Celauran [ Tue Apr 07, 2015 7:28 pm ]
Post subject:  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.

Author:  justas28 [ Wed Apr 08, 2015 10:24 am ]
Post subject:  Re: Unique likes

Thanks for your answer. Is there some kind of unique machine id, to identify different pcs under the same ip address?

Author:  Celauran [ Wed Apr 08, 2015 10:33 am ]
Post subject:  Re: Unique likes


Author:  justas28 [ Wed Apr 08, 2015 10:37 am ]
Post subject:  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.

Author:  justas28 [ Wed Apr 08, 2015 10:48 am ]
Post subject:  Re: Unique likes

Can I use simple cookies to store arrays of what sort of posts each visitor liked? Would that help?

Author:  Celauran [ Wed Apr 08, 2015 11:02 am ]
Post subject:  Re: Unique likes

No. Cookies can be cleared by the user.

Author:  Christopher [ Wed Apr 08, 2015 11:36 pm ]
Post subject:  Re: Unique likes


Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/