<html>
<body>
<?php
  // setup variables
  $cmd=$_GET["cmd"];
  $mode=$_GET["mode"];
  $code=$_GET["code"];

  $now=time(); // stamp the current time
  $st=date('Y-m-d H:i:s',$now); // set the datetime string to correct format
  $mycard=359452; // replaced by your card number
  $rtime=$date . $time; // access the date and time of the reader
  $remote_open=1;

  echo "<AVEA>"; // starting flag
  switch ($cmd) {
  case "PU": // power up
    echo "CK=$st"; // set clock
    if ($mode==ID2) { // for web08s only
      echo "DHCP=1"; // turn on the DHCP feature
    }
    break;

  case "CO": // card only
    if ($code==$mycard) {
      echo "MSG=3f737937"; // show message OPEN
      echo "GRNT=01"; // grant access
    } else {
      echo "DENY"; // deny access
    }
    break;

  case "HB": // heartbeat
    echo "CK=$st"; // set clock
    break;

  case "PG": // being pinged
    if ($_GET["contact"]=="CLOSE") {
      echo "GRNT=01"; // grant access
    }
    break;

  case "SW": // being pinged
    if (remote_open==1) {
      echo "GRNT=01"; // grant access
    }
    break;
  }
  echo "</AVEA>"; // ending flag
?>
</body>
</html>