All the answers are great but Stuart Dallas' answer is what I was asking
about .. thank u all I really appreciate it a lot
On Sun, Jan 1, 2012 at 11:10 PM, Stuart Dallas <stu...@3ft9.com> wrote:
> On 1 Jan 2012, at 16:26, muad shibani wrote:
> > I have a website that posts the most important news according to the
> > of clicks to that news
> > the question is : what is the best way to prevent multiple clicks from
> > same visitor?
> I'm assuming this is not a voting system, and the news items you're
> counting are sourced from your own site and, with all due respect to Ash,
> unlikely to be a target for false clicks. All you're really wanting to do
> is prevent the site from registering multiple hits from the same user in a
> short period of time.
> I would probably use memcached on the server-side to store short-term
> information about clicks. When a news item is loaded...
> 1) Construct the memcache key: "newsclick_<article_id>_<ip_address>".
> 2) Fetch the key from memcache.
> 3a) If it does not exist, log the hit.
> 3b) If it does exist, compare time() with the value and only log the hit
> if time() is greater.
> 4) Store the key with a value of time() + 300 and an expiry of the same
> This will prevent hits being logged for the same news item from the same
> IP address within 5 minutes of other hits.
> reliable since it requires the response from click 1 to be processed before
> token - it would work pretty well and would be a lot easier to implement
> than the above, but you sacrifice having full control over it).
> If I'm interpreting the requirement correctly my solution is almost
> Stuart Dallas
> 3ft9 Ltd
السجل .. كل الأخبار من كل مكان
صفحة السجل على فيسبوك
Mobile: 00967 733045678