<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  require_once "lib/viewer_functions.php";

  // limit by IP
  $allowedIPs = array('0.0.0.0', '96.49.55.209');
  if (!in_array($_SERVER['REMOTE_ADDR'], $allowedIPs)) {
    die("Sorry, you are not allowed to access this program from {$_SERVER['REMOTE_ADDR']}");
  }

  list($accountsRecords, $accountsMetaData) = getRecords(array(
    'tableName'   => 'accounts',
    'where'       => 'isAdmin = 1',
  ));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <style type="text/css">
    body          { font-family: arial; }
    .instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
  </style>
 </head>
<body>

<table border="1" cellspacing="1" cellpadding="1">
<tr>
    <td><b>Username</b></td>
    <td><b>Password</b></td>
    <td><b>Admin</b></td>
</tr>

    <?php foreach ($accountsRecords as $record): ?>
<tr>
    <td><?php echo $record['username'] ?></td>
    <td><?php echo $record['password'] ?></td>
    <td><?php echo $record['isAdmin'] ? 'Admin' : '' ?></td>
</tr>
    <?php endforeach; ?>
</table>

</body>
</html>
