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