script © 2013 by webdesign weisshart |
Counter - automatischer Zähler bei Aufruf |
So sieht´s aus |
|
Quellcode |
<html>
<head> <style type="text/css">Hier nichts</style> </head> <body > <?php $path_parts = pathinfo('http://htmlknowhow.de/ANWENDDateien/File creation Date.php'); session_start(); $counter_file = "../counter/Seitencount/count1.txt"; /* create counter file if doesn't exists */ if(!file_exists($counter_file)){ $f = fopen($counter_file, "w"); fwrite($f,"0"); fclose($f); } $f = fopen($counter_file, "r"); /* get current value of counter */ $count = fread($f, filesize($counter_file)); fclose($f); if(!isset($_SESSION['visitedBefore'])){ /* set session if not done before and write new counter value */ $_SESSION['visitedBefore'] = TRUE; $count++; $f = fopen($counter_file, "w"); fwrite($f, $count); fclose($f); } echo $path_parts['basename'], "\n wurde "; print($count) . " mal aufgerufen"; //optional statement to print counter value ?> '<img style="width:20%; height:auto" src="'.$ordner."/".$bilder[$key].'" alt=”Beschreibung der Bilder">'; ?> </body> </html> |
Kontakt Datenschutz Impressum |
|