session_start();
if($_SESSION['hasbeenhere'] == 1)
{
}
else
{
$_SESSION['hasbeenhere'] = 1;
}
If a person does not have cookies allowed, this will fail. If someone goes to another page and returns, he will be shown as updated.
, , .
- , , F5 200 , .
$page = $_SERVER['REQUEST_URI'];
if(!isset($_SESSION[$page]['count']))
{
$_SESSION[$page]['count'] = 1;
$_SESSION[$page]['first_hit'] = time();
$_SESSION[$page]['banned'] = false;
}
else
{
$_SESSION[$page]['count']++;
}
if($_SESSION[$page]['banned'] == true)
{
die();
}
if($_SESSION[$page]['first_hit'] < time() - 30)
{
$_SESSION[$page]['count'] = 1;
}
if($_SESSION[$page]['count'] > 100)
{
$_SESSION[$page]['banned'] = true;
}