Skip to content

ip

filebased ip lock

<?php $file = “ip_data.dat”; $duration = 30*60;  //30 minutes $lines = file($file); foreach($lines as $line) {     list($ip, $time) = explode(“µ”, $line);     if($time > time()–$duration) {         $ips[$ip] = trim($time);     } } $ip = $_SERVER[‘REMOTE_ADDR’]; if(@array_key_exists($ip, $ips)) {     if($ips[$ip] > time()–$duration) {         // TRUE         $ips[$ip] = time();         $was_here = TRUE;     } } else {     $ips[$ip] = time();     $was_here = FALSE; } $fp = fopen($file, “w”); foreach($ips as $ip=>$time) {     fputs($fp, $ip.“µ”.$time.“\n“);… Read More »filebased ip lock