Hvorfor får jeg denne fejl på tæller
HejJeg har et tællerscript på min indgangsside www.hgc.dk som pludeselig giver problemer.
Hvis I går ind på siden ser i fejlmeldingen i venstre rubrik "besøgende".
Følgende script giver problemet:
<div class="leftbox">
<h4><img src="/graphics/markerw.gif" alt="" align="bottom">Besøgende</h4>
<p>
<?php
// Our log file;
$counter = "/counter.txt";
// Date logging;
$today = getdate();
$month = $today["month"];
$mday = $today["mday"];
$year = $today["year"];
$current_date = $mday . $month . $year;
// Log visit;
$fp = fopen($counter, "a");
$line = $_SERVER['REMOTE_ADDR'] . "|" . $mday . $month . $year . "\n";
$size = strlen($line);
fputs($fp, $line, $size);
fclose($fp);
// Read log file into array;
$contents = file($counter);
// Total hits;
$total_hits = sizeof($contents);
// Total hosts;
$total_hosts = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
array_push($total_hosts, $entry[0]);
}
$total_hosts_size = sizeof(array_unique($total_hosts));
// Daily hits;
$daily_hits = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
if ($current_date == chop($entry[1])) {
array_push($daily_hits, $entry[0]);
}
}
$daily_hits_size = sizeof($daily_hits);
// Daily hosts;
$daily_hosts = array();
for ($i=0;$i<sizeof($contents);$i++) {
$entry = explode("|", $contents[$i]);
if ($current_date == chop($entry[1])) {
array_push($daily_hosts, $entry[0]);
}
}
$daily_hosts_size = sizeof(array_unique($daily_hosts));
// Let's display everything;
echo "Totale hits: " . $total_hits . "<br>Totale brugere: " . $total_hosts_size . "<br>Daglige hits: " . $daily_hits_size . "<br>Daglige brugere: " . $daily_hosts_size;
?>
</p>
</div>