Servus ich hab ein Counter und möchte gerne 2 Ip sperren also das sie nicht mehr mitgezählt werden!!!
hier der fertige Counter:
___________________________________________
[php:1:a34974dbae]
<?php
$datei = "counter.txt";
$file = fopen($datei, "r");
$stand = fread($file, filesize($datei));
$stand = $stand+1;
fclose($file);
function ipcheck($client_ip)
{
switch(func_num_args())
{
case 4: $operating_dir=func_get_arg(3);
case 3: $max_timediff=func_get_arg(2);
case 2: $log_ip=func_get_arg(1);break;
default: $operating_dir=""; $max_timediff="3600"; $log_ip=true;
}
switch(func_num_args())
{
case 2: $max_timediff="3600";
case 3: $operating_dir="";break;
}
$file=$operating_dir . "ip.txt";
$seenbefore=false;
$lines=file($file);
for($i=0;$i<count($lines);$i++)
{
$ip_chunks=explode("-",$lines[$i]);
$timediff=time()-$ip_chunks[1];
if($timediff>$max_timediff) $lines[$i]="";
elseif($ip_chunks[0]==$client_ip) $seenbefore=true;
}
$handle = fopen($file,"w+");
if ($handle)
{
for($i=0;$i<count($lines);$i++) fputs($handle, $lines[$i]);
if(!$seenbefore && $log_ip) fputs($handle, $client_ip . "-" . time() . "\n");
fclose($handle);
}
return($seenbefore);
}
if(!ipcheck($REMOTE_ADDR))
{
$file = fopen($datei, "w");
fputs($file, $stand);
fclose($file);
}
?>
Sie sind der <?php echo $stand; ?>. Besucher[/php:1:a34974dbae]
___________________________________
Hoffe ihr könnts ma helfen!!
mfg marko