Thread View: be.comp.programming
2 messages
2 total messages
Started by Red Head
Sun, 03 Aug 2003 13:54
php counter
Author: Red Head
Date: Sun, 03 Aug 2003 13:54
Date: Sun, 03 Aug 2003 13:54
35 lines
1740 bytes
1740 bytes
ik heb een counter gemaakt met afbeeldingen in php
maar de afbeeldingen worden niet weergegeven en ze staan in dezelfde dir als
de php file
weet iem hoe dat kan?
<?php
if (file_exists("counter.txt")){
$fp = fopen("counter.txt", "r+");
$count = fgets($fp, 6);
$count++;
rewind($fp);
fputs($fp, $count, "w");
fclose($fp);
} else {
$fp = fopen("counter.txt", "w");
$count = "1";
fputs($fp, $count, 6);
fclose($fp);
}
echo "u bent de " . $count . "e bezoeker!";
//deze functie zorgt voor de nullen voor het getal
$count = sprintf("%05d", $count);
//de teller samenstellen uit afbeeldingen
$afbeelding = " ";
for ($i = 0; $i < 5; $i++){
$afbeelding = $afbeelding . "<img scr=" . substr($count, $i, 1) . ".gif
width=16 height=16>";
}
echo $afbeelding
?>
Re: php counter
Author: Nicolas Barbier
Date: Sun, 03 Aug 2003 14:57
Date: Sun, 03 Aug 2003 14:57
14 lines
1476 bytes
1476 bytes
Red Head wrote: > ik heb een counter gemaakt met afbeeldingen in php > maar de afbeeldingen worden niet weergegeven en ze staan in dezelfde dir > als de php file > weet iem hoe dat kan? (snip) Kijk eens naar de gegenereerde HTML, dan kan je besluiten of het al dan niet aan je PHP code ligt. -- Nicolas Barbier
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads