<?php
    session_start();
	if ( empty($_SESSION['login']) ) {
        header( 'Location: login.php' );
        die;
	}

	include 'include/header.php';
?>

    <script type="text/javascript">
        $(function(){
            $('#report').load(function() {
                this.style.height = this.contentWindow.document.body.scrollHeight + 'px';
            });
        });
    </script>

    <div class="wrap">

<?php include('include/nav.php'); ?>

<?php
    include 'include/database.php';
    $connection = connect($database);
    $canAdmin = canAdministrate($connection, $_SESSION['login']);
	$connection = null;
	if ( $canAdmin ) {
        echo '
        <iframe id="report" class="center pad-bottom" src="reportico/runadmin.php" seamless></iframe>
        ';
	} else {
        echo '
        <iframe id="report" class="center pad-bottom" src="reportico/run.php" seamless></iframe>
        ';
    }
?>
        
    </div>

<?php include('include/footer.php'); ?>