<?php
require_once "config/session.php";

if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) {
    header("location: index.php");
    exit;
}

include('navbar.php');

?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>


<div id="tableHolder"></div>


<script type="text/javascript">
$(document).ready(function(){
  refreshTable();
});
var text = document.getElementById("tableHolder").textContent;
function refreshTable(){
	$.get("getDashboard.php", function (data) {
        var newtext = data;
		if(newtext != text){
			text = newtext;
			$('#tableHolder').html(data);
			console.log("Updated!");
		}
    });
setTimeout(refreshTable, 2000);
}
</script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>