Hallo.
Ich habe folgendes Counter-Scipt, das Script funktioniert wohl auch prima. Nun verstehe ich nicht sehr viel von PHP und möchte dieses Script auf eine Homepage einbauen. Aber bevor ich das mache möchte ich genau wissen wie dieses Script funktioniert.
Besonders möchte ich wissen was in dieser Zeile die 20 bedeutet?
$line=fgets($handle,20);
Kann mir jemand eine Erklärung liefern?
Ich bedanke mich schon im Voraus.
Hier das Script:
// Configuration
$dataFile=„count.dat“;
// Set the localtion of the datafile
$outStringFormat=„Sie sind der [COUNTER]. Besucher.“;
// Use the variable „[COUNTER]“ for the number of visit
$useIpLocking=true;
// Set ‚false‘ if you don’t want to use ip-locking
// Try to open data-file
$handle=@fopen($dataFile,„r“);
if ($handle)
{
// Read number of vistors and last ip
$line=fgets($handle,20);
$tmpArray=explode(";",$line);
$cnt=$tmpArray[0];
$ip=$tmpArray[1];
fclose($handle);
}
else $cnt=0;
// Count up if last ip is different to the user’s ip
if ($ip!=$REMOTE_ADDR||!$useIpLocking) $cnt++;
printf("%s",str_replace("[COUNTER]",$cnt,$outStringFormat));
$tmpArray[0]=$cnt;
$tmpArray[1]=$REMOTE_ADDR;
$line=implode(";",$tmpArray);
$handle=fopen($dataFile,„w“);
fputs($handle,$line);
fclose ($handle);
?>