Geronantimo
Technical User
Is it possible to limit the number of requests that are made to a webpage in the course of a day based on IP address and some other information?
I have the following basic tracking script:
The tracking information ("visitTime" and "ip") are recorded in the text file "visitorLog.txt" and the script above is called in the webpage using
How can I modify the script to prevent access to the webpage if the visitor has already visited 20 times in the previous 24 hours?
Thanks in advance and I look forward to hearing from you.
I have the following basic tracking script:
Code:
<?php
$agent = $_SERVER['HTTP_USER_AGENT'];
$uri = $_SERVER['REQUEST_URI'];
$ip = $_SERVER['REMOTE_ADDR'];
$ref = $_SERVER['HTTP_REFERER'];
$visitTime = date("r"); //Example: Thu, 21 Dec 2000 16:01:07 +0200
$logLine = "$visitTime - IP: $ip || User Agent: $agent || Page: $uri || Referrer: $ref\n";
$fp = fopen("visitorLog.txt", "a+");
fputs($fp, $logLine);
fclose($fp);
?>
Code:
<?php include "visitorLog.php"; ?>
Thanks in advance and I look forward to hearing from you.