hallo iedereen,
Ik heb een probleempje. Ik heb een teller op mijn indexpagina maar nu heb ik een beetje mijn bestanden geordend en in wat andere mappen gezet. Nu heb ik dus een php bestand in root/siteprog/teller/bestand1.php en in dat bestand wil ik linken naar de txt root/page/tel/uit/txts/telhome.txt ...
Even de code erbij
Hoe kom ik nu bij dat bestand? Ik had wel wat gelezen d.m.v. include maar ik zou niet weten hoe ik dit hier in moet gebruiken.
Alvast bedankt,
Ginojo
Ik heb een probleempje. Ik heb een teller op mijn indexpagina maar nu heb ik een beetje mijn bestanden geordend en in wat andere mappen gezet. Nu heb ik dus een php bestand in root/siteprog/teller/bestand1.php en in dat bestand wil ik linken naar de txt root/page/tel/uit/txts/telhome.txt ...
Even de code erbij
PHP:
<?php
//Controleren of teller.txt bestaat, zo niet file aanmaken:
if (file_exists 'http://website.nl/page/uit/txts/teller/telhome.txt') {
$bestand = fopen('http://website.nl/page/uit/txts/teller/telhome.txt', "r+"); // Bestand openen
$telling = fgets($bestand, 6); // Tellerstand lezen
$telling++; // Stand verhogen met 1
rewind($bestand); // Pointer terugzetten
fwrite($bestand, $telling, 6); // Stand wegschrijven
fclose($bestand); // Bestand sluiten
} else {
$bestand = fopen('http://website.nl/page/uit/txts/teller/telhome.txt', "w"); // Bestand openen
$telling = "1"; // Stand op 1 zetten
fwrite($bestand, $telling, 6); // Stand wegschrijven
fclose($bestand); // Bestand sluiten
}
$telling = sprintf("%05d", $telling);
// Teller samenstellen uit afbeeldingen:
$teller = "";
for ($i = 0; $i < 5; $i++) {
$teller .= '<img alt="" align="absmiddle" border="0" src="' . substr($telling, $i, 1) . '.gif">';
}
?>
Alvast bedankt,
Ginojo