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