PHP-Code: <?php //path to the count.txt count storage file $counter_file = "counter/count.txt"; //open the file for reading if(!($fp = fopen($counter_file , "r"))) die ("cannot open file"); //store the first 24 bytes of data from the file into $counter $counter = (int)fread($fp, 24); //close the file fclose($fp); //increment $counter by 1 $counter++; //open the counter file for writing $fp = fopen($counter_file , "w"); //write the new $counter value into the file fwrite($fp, $counter); //close the file fclose($fp); //number images are stored in the images directory //and are numbered from 0.gif to 9.gif //loop through the values of $counter and //use the strlen function to check the length of $counter for ($i = 0 ;$i < strlen($counter) ; $i++) { //the <img src> tag $imgsrc = SubStr($counter,$i ,1); echo '<a href="http://www.notathing.com/downloads.php" target="_blank"><img src="counter/images/' . $imgsrc . '.gif" border="0"></a>'; } ?> So sollte es nun laufen
<?php //path to the count.txt count storage file $counter_file = "counter/count.txt"; //open the file for reading if(!($fp = fopen($counter_file , "r"))) die ("cannot open file"); //store the first 24 bytes of data from the file into $counter $counter = (int)fread($fp, 24); //close the file fclose($fp); //increment $counter by 1 $counter++; //open the counter file for writing $fp = fopen($counter_file , "w"); //write the new $counter value into the file fwrite($fp, $counter); //close the file fclose($fp); //number images are stored in the images directory //and are numbered from 0.gif to 9.gif //loop through the values of $counter and //use the strlen function to check the length of $counter for ($i = 0 ;$i < strlen($counter) ; $i++) { //the <img src> tag $imgsrc = SubStr($counter,$i ,1); echo '<a href="http://www.notathing.com/downloads.php" target="_blank"><img src="counter/images/' . $imgsrc . '.gif" border="0"></a>'; } ?>
Foren-Regeln