<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Moja strona WWW</title>
  </head>
  <body>
    <p>Lista odwiedzin:</p>
    <div>
    <?php
      include "Stats.php";

      $statobj = new Stats("./stats.txt");

      if(($str = $statobj->readData()) === false){
        echo "<p>Lista nie jest w tej chwili dostępna.</p>";
      }
      else{
        echo $str;
      }
      $data = date("Y-m-d G:i");
      $addr = $_SERVER['REMOTE_ADDR'];
      if(isset($_SERVER['HTTP_USER_AGENT'])){
        $agent = $_SERVER['HTTP_USER_AGENT'];
      }
      else{
        $agent = '';
      }
      $statobj->writeData($data, $addr, $agent);
    ?>
    </div>
  </body>
</html>
