Ich habe folgendes Problem. Ich will ein Downloadcounter in meine Homepage einfügen. Klappt alles wunderbar. ABER: Mein Hintergrund ist schwarz und deshalb soll er mir die Zahl in weiß anzeigen. Habe alles versucht, was mir Google gezeigt hat. Hoffe mir kann jemand helfen. Hier der Code:
<?php
$timestamp=time();
$aktuellJahr=date("Y",$timestamp);
$aktuellMonat=date("m",$timestamp);
$downloadAnzahl=0;
$startJahr=$aktuellJahr;
if(file_exists("./dl-counter/admin/startJahr.txt"))
{
$jahr=file("./dl-counter/admin/startJahr.txt");
$startJahr=$jahr[0];
}
else
{
$dateiHandle=fopen("./dl-counter/admin/startJahr.txt", "w");
fwrite($dateiHandle, $startJahr);
fclose($dateiHandle);
}
if(isset($download))
{
$verzeichnis="./dl-counter/download/";
$verzhandle=opendir($verzeichnis);
$dateiListe=array();
while($dateiName=readdir($verzhandle))
{
if(($dateiName!=".") && ($dateiName!=".."))
{
if(!(file_exists("./dl-counter/counterFiles/".$dateiName.$aktuellJahr.".txt")))
{
$dateihandle=fopen("./dl-counter/counterFiles/".$dateiName.$aktuellJahr.".txt", "w");
for($i=0; $i<12; $i++)
{
fwrite($dateihandle, 0);
fwrite($dateihandle, "\n");
}
fclose($dateihandle);
}
}
$dateiListe[]=$dateiName;
}
foreach($dateiListe as $dateiName)
{
if($dateiName==$download)
{
for($a=$startJahr; $a<=$aktuellJahr; $a++)
{
if((file_exists("./dl-counter/counterFiles/".$dateiName.$a.".txt")))
{
$counterstand=file("./dl-counter/counterFiles/".$dateiName.$a.".txt");
for($i=0; $i<12; $i++)
{
$downloadAnzahl+=$counterstand[$i];
}
}
else
{
$downloadAnzahl+=0;
}
}
}
}
closedir($verzhandle);
echo $downloadAnzahl;
}
else
{
echo "Die Variable \$download wurde nicht angegeben!";
}
Alles anzeigen