AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Zugriffszähler für Homepage

Ein Thema von Amo · begonnen am 5. Feb 2006 · letzter Beitrag vom 6. Feb 2006
Antwort Antwort
Benutzerbild von malo
malo

Registriert seit: 19. Sep 2004
2.115 Beiträge
 
#1

Re: Zugriffszähler für Homepage

  Alt 5. Feb 2006, 17:53
Du brauchst eine .php-Datei. Da kannst du ganz normal deinen HTML-Code reinschreiben, wie du lustig bist. An den Stellen, wo PHP vorkommt, fügst du einfach den Quelltext ein.
Code:
<? function getCounter($counterID)
{
   // each counter value is stored inside a unique file
   // We use $counterID as a part of the file name
   // Example: file name will be "counter1.txt" if $counterID is set to "1"

   $fileName = "counter".$counterID.".txt";

   if( file_exists($fileName) ) {
      list($numVisitors)=file($fileName); // Read contents from the file
   } else {
      $numVisitors=0; // This is the first time the page is accessed
   }

   $numVisitors=$numVisitors+1; // Increase the count

   $fil=fopen($fileName,"w");   // Open the file to replace old value
   fputs($fil,$numVisitors);    // Write the new count to the file
   fclose($fil);           // Close the file
   return $numVisitors;     // Return the new count
}
?>
Das ist ja eine Funktion, wie man erkennen kann. Praktischerweise ist der bereits in den PHP-Scriptbegrenzern <? und ?>.
Das kannst du erst einmal irgendwo an den Anfang kopieren.
Da, wo du angezeigt haben willst, wieviele Besucher deine Homepage hat, musst du folgendes einfügen:
Code:
<? echo getCounter("1"); ?>
Das gibt dir dann die Anzahl der Aufrufe aus
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz