So, nu aba. Das hier ist jetzt garantiert die richtige Version: PHP-Code: <?php $counterfile = "counter/count.txt"; $zeitfenster = 600; $zeit = time(); $update="1"; $fp = fopen($counterfile,"r"); $i=0; while (feof($fp)==0) { $line=chop(fgets($fp,260)); $i++; $testarray[$i]=$line; } fclose($fp); $diff = $zeit-$testarray[3]; if (($diff) >= $zeitfenster) { $update="0"; } if ($testarray[2] != $REMOTE_ADDR or $update == "0") { $ftp = @fopen($counterfile,"r+"); $count = (int)fgets($ftp,100); $count++; rewind($ftp); fwrite($ftp,"$count\n$REMOTE_ADDR\n$zeit\n"); fclose($ftp); } else { $count="$testarray[1]"; } // Grafik-Funktionen $image = imagecreate(70, 13); // erzeugt das Basisbild $trans = imagecolorallocate($image, 0xCC, 0xCC, 0xCC); // Transparenz definieren (für den Hintergrund) $textcolor = imagecolorallocate($image, 192, 192, 192); // Textfarbe im RGB-Format(änderbar) $transparent = imagecolortransparent($image, $trans); // Transparenz zuordnen ImageString ($image, 3, 0, 0, "$count", $textcolor); // den Counterstand in das Bild zeichnen header('Content-type: image/png'); // Dem Browser sagen dass das hier ein Bild ist header('Cache-Control: no-cache, must-revalidate'); // Der Browser solls nicht cachen header('Pragma: no-cache'); imagepng($image); // Gibt das Bild als PNG-Grafik aus imagedestroy($image); // löscht das Bild aus dem Datenpuffer ?> Habs eben selbst getestet. Das kommt davon wenn man den Code eben fix aus eine andere Page rauspuhlt und ihn sich zuvor nicht anschaut.
<?php $counterfile = "counter/count.txt"; $zeitfenster = 600; $zeit = time(); $update="1"; $fp = fopen($counterfile,"r"); $i=0; while (feof($fp)==0) { $line=chop(fgets($fp,260)); $i++; $testarray[$i]=$line; } fclose($fp); $diff = $zeit-$testarray[3]; if (($diff) >= $zeitfenster) { $update="0"; } if ($testarray[2] != $REMOTE_ADDR or $update == "0") { $ftp = @fopen($counterfile,"r+"); $count = (int)fgets($ftp,100); $count++; rewind($ftp); fwrite($ftp,"$count\n$REMOTE_ADDR\n$zeit\n"); fclose($ftp); } else { $count="$testarray[1]"; } // Grafik-Funktionen $image = imagecreate(70, 13); // erzeugt das Basisbild $trans = imagecolorallocate($image, 0xCC, 0xCC, 0xCC); // Transparenz definieren (für den Hintergrund) $textcolor = imagecolorallocate($image, 192, 192, 192); // Textfarbe im RGB-Format(änderbar) $transparent = imagecolortransparent($image, $trans); // Transparenz zuordnen ImageString ($image, 3, 0, 0, "$count", $textcolor); // den Counterstand in das Bild zeichnen header('Content-type: image/png'); // Dem Browser sagen dass das hier ein Bild ist header('Cache-Control: no-cache, must-revalidate'); // Der Browser solls nicht cachen header('Pragma: no-cache'); imagepng($image); // Gibt das Bild als PNG-Grafik aus imagedestroy($image); // löscht das Bild aus dem Datenpuffer ?>
--
Foren-Regeln