<?php

function require_login() {
    if ( !$_SESSION['validated'] ) {
        header("Location: login.php");
    }
}

//
// This function outputs the HTML footer along with adding script tags
// for any script files passed to the function. These files are assumed
// to be in the js/ folder.
//
function includeHTMLFooter(...$scripts) {
    require 'htmlfooter.php';
    foreach ( $scripts as $script ) {
       echo "\n<script type='text/javascript' src='js/", trim($script), "'></script>\n";
    }
    echo "</body>\n";
    echo "</html>\n";
}
