PX : code

Simply Counter by Ray Adams
Download this code


<?php
/*
  (c) 2000 Ray Adams
  Sample counter.
  Note: Directory ./counter will be created automaticaly if doesn\'t exists
*/
 
if (!file_exists("./counter\")) {
 mkdir(\"./counter\",0700);
 }
 $icount=0;
 if (file_exists(\"./counter/count.dat\"))
 {
    $fp = fopen(\"./counter/count.dat\", \"r\");
    $bcount=fgets($fp,10000);
    $icount=intval($bcount);
    $icount++;
    fclose($fp);
    $fp = fopen(\"./counter/count.dat\", \"w\");
    fputs($fp,$icount);
    fclose($fp);
  } else
  {
    $icount++;
    $fp = fopen(\"./counter/count.dat\", \"w\");
    fputs($fp,$icount);
    fclose($fp);
  }
echo \"<center>You are visitor number
<center><table bgcolor=blue>
<tr>
<td><font face=\'Verdana\' size=3 color=Yellow><b>$icount</td>
</tr>
</table></font></b>\";
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.