34a3c733eef8ce6bc519fa0ab7d3993caa295e72
[silc.git] / public_html / counter.php
1 <?php
2 //test 2
3
4 function Hits() {
5
6 // $datafile has to be writable by http server user uid
7 // else hits count will not be increased, only printed out
8
9   $datafile = $DocRoot."COUNTER";
10
11   if (Is_Writable($datafile)) {
12     $fp = FOpen($datafile, "r+");
13     $writable = "true";
14   }
15   else
16     if (Is_Readable($datafile)) $fp = FOpen($datafile,"r");
17     else return;
18   
19   $hits = FGets($fp,255) + 1;
20   if(!$hits) $hits = 1;
21
22   if($writable) {
23     Rewind($fp);
24     FPuts($fp, $hits);
25   }
26
27   FClose($fp);
28   echo $hits." hits";
29 }
30
31 Hits();
32
33 ?>
34
35 $SILC: $