views:

51

answers:

1

hi

i want to know the user how many times enter in my website and also from the same ip address

using php.

i would like to prevent the site from user who continuously hit my site with in 2 seconds or 1 seconds.

if continuously any user hit my site i would like to avoid that user ip address.

thanks in advance

A: 

I would create a script which writes this information into a database, and I'd probably also include the PHP Session so you can differentiate between hits and visits.

Have a look at the PHP global reserved variables. http://www.php.net/manual/en/reserved.variables.server.php

DavidYell
I wouldn't use sessions if for that purpose only
Col. Shrapnel
@Col.Shrapnel the OP changed the question after @David gave his answer. The original question was phrased more in a way that suggested the OP was looking to do web analytics.
Gordon
$_COOKIES would be preferred, session_start() serializes the requests a.k.a. blocking request2 if request1 is still busy.
Bob Fanger