<html>
    <head>
        <meta http-equiv="refresh" content="15">
    </head>
    <body style="background-image: url('./style/images/fabric-pattern.png')">
        <?php

        $statement = $RUNTIME['PDO']->prepare("SELECT * FROM Presence WHERE RegionID != '00000000-0000-0000-0000-000000000000' ORDER BY RegionID ASC");
        $statement->execute(); 

        if($statement->rowCount() == 0)
        {
            echo "<h1>Es ist niemand online!</h1>";
        }else{

            echo '<table style="width:350px;margin-left:auto;margin-right:auto;margin-top:25px"><tr><th align="left" style="background-color: #FF8000;">Name</th><th align="left" style="background-color: #FF8000;">Region</th></tr>';
            $entryColor = TRUE;
            while($row = $statement->fetch()) 
            {
                if($entryColor == TRUE)
                $entry = '<tr style="background-color: #F2F2F2;"><td>'.trim($RUNTIME['OPENSIM']->getUserName($row['UserID'])).'</td><td>'.$RUNTIME['OPENSIM']->getRegionName($row['RegionID']).'</td></tr>';

                if($entryColor == FALSE)
                    $entry = '<tr style="background-color: #E6E6E6;"><td>'.trim($RUNTIME['OPENSIM']->getUserName($row['UserID'])).'</td><td>'.$RUNTIME['OPENSIM']->getRegionName($row['RegionID']).'</td></tr>';

                echo $entry;
                $entryColor = !$entryColor;
            }

            echo '</table>';
        }
        ?>
    </body>
</html>