}
if (isset($_POST['logout'])) {
    unset($_SESSION['robo']);
    header('Location: index.php');
    exit;
}
$username = $_SESSION['robo'];
$api = new roboSISAPI();
if (!$api->isAdmin($username)) {
    header('Location: index.php');
    exit;
}
date_default_timezone_set('America/Los_Angeles');
// all times are in PST
if (isset($_GET['sheldon'])) {
    $api->inputCheckIn("12erich");
    echo "Welcome back, Dr. Cooper.";
    exit;
}
?>
<!DOCTYPE html>
<head>
	<meta charset="utf-8">
	<title>Robotics 1072 Dashboard - Admin</title>
	<meta name="description" content="">
	<meta name="author" content="">
	<!-- <link rel="stylesheet" type="text/css" href="style3.css">
	<link rel="stylesheet" type="text/css" href="reset.css"> -->
	
	<style>
	.clearfix:before, .clearfix:after {
						<input name="checkin" type="submit" class="checkin" value="Check-In" />
					</fieldset>
					</form>
				</div>
				<h2>Recent Check-Ins</h2>
				<p class="clearfix">
					<ul>
						<?php 
function __autoload($class)
{
    require_once $class . '.php';
}
$username = $_SESSION['robo'];
$api = new roboSISAPI();
if (isset($_POST['checkin'])) {
    $api->inputCheckIn($username);
}
//echo 'here';
$result = $api->getCheckIns($username);
//echo $result;
$table = json_decode($result);
for ($i = 0; $i < count($table); $i++) {
    echo "<li>" . $table[$i] . "</li>";
    //echo "<br />";
}
?>
					</ul>
				</p>
			</div>
		</div>