
<?php

// gets all users in the system

include 'includes/database.php';
$db=new MySQLDatabase();
$db->open_connection();
$et = date('Y-m-d h:i:s');
$st = date('Y-m-d h:i:s',strtotime("-2 hours"));

$sql = mysqli_query($db->connection, "SELECT DISTINCT username FROM loginhistory WHERE logintime between '$st' AND '$et';") or die (mysqli_error($db->connection) );
$rown='';
while ($row = mysql_fetch_array($sql, MYSQLI_ASSOC)){
    $rown = $rown.' '.$row['username']; 
    }   
$db->close_connection();

echo $rown;

?>
