Re: Most viewed?

From: Date: Thu, 17 Apr 2008 16:40:51 +0000
Subject: Re: Most viewed?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-273196@lists.php.net to get a copy of this message
If you want to take it a step further and only record a *click* if a person hasn't clicked this article before, you have several options. You can save a cookie on their computer saying they've clicked that article - of course they can delete the cookie, which may skew the count. Or you can save their IP address in a database (or file, if you want to choose that method) - only increment if that IP address hasn't clicked that article before. And of course, it's also very possible that their IP address can change. However, it should work pretty well.
Or they could share an IP with a few hundred other people so that all of them combined only get counted one time.
Because of this if it's not too important (eg it's just ratings of articles) personally I would choose the cookie method. If it's uber important you could have the user login before they can rate stuff. -- Richard Heyes +-----------------------------------------+ |Access SSH through a Windows mapped drive| | http://www.phpguru.org/sftpdrive | +-----------------------------------------+

« previous php.general (#273196) next »