FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Create a like button





Arrogant
I am learning and trying to create a site using PHP.
How can I create a unique like button. A user should be able to like a content only once
I could create a user login and save the information in the user database but I would like that if unregistered users could also like the contents.
Peterssidan
You need some way of detecting unique users. One way is to use the IP address, but note that it is not perfect because more than one person can use the same IP and sometimes their IP changes.
Arrogant
I was also thinking about storing the IP in a database.
How can cookies be used? Will it be more practicable?
sonam
Arrogant wrote:
I was also thinking about storing the IP in a database.
How can cookies be used? Will it be more practicable?


I think cookies are better idea. Of course you cannot stop professionals to like your site many times (they have different browsers, clear cookies, etc.) but for regular user this is quite good solution.

Sonam
codersfriend
This is for logged in users right. I think you should start with the database. Like we have a users table and a sites table joined by a relational table called likes
Arrogant
I am trying to make the like button accessible for the non-users as well.
Without them signing in, they could like a content
So what could be used to identify a particular user?
Peterssidan
You can use cookies but if you want to prevent people abusing the like button I think you have to use IP somehow. Maybe you could use a combination of IP and cookies. At least set a time limit so that the same IP can't vote again until some amount of time has past.

This will not prevent the usage of proxies. Many web proxies use the same User-Agent header as the original user so I guess you could try catch if the exact same User-Agent is being used from many IPs in a short time. I guess there are more header fields you could use to make it more reliable but not sure if it's worth the trouble anyway.

Even with a sign-up system people can abuse the system by creating multiple accounts.

If you want you could let each like only count for a fixed amount of time so if no one likes the item it will eventually drop down to zero. This would make abusing less attractive because it will have to be repeated once in a while but this way is probably only suitable for pages with many visitors otherwise most of the items will always have very low like count.
Marcuzzo
cookies can be removed and will not be there when the same person uses another browser, same goes for sessions.
I'd say, only registered users can like something...

besides, why would you want to have unregistered users "like" something.
this would result into "userX, userY userZ and 142 unregistered users like this"...
Arrogant
Yeah you've got a point
I should make it accessible for the registered users only.
Related topics
Installing Nuke
How to code Minimise button using action script in Flash?
How can I make a linux partition just using Disk Managment.
Please help.....Flash, PHp, MySql
Hosting my first Forum
how to create a pop-up input box? pls.
PhpMyAdmin
create swishmax Login with phpbb db
Change Start Button
Active Button With Css And Php...
How to create template with DreamWeaver?
i cannot create database in frih
Upload a file from host to other file host
Portable web design/development workstation guide
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.