Example #1
0
/**
 * Autoloads a class from this folder or a subfolder (if the class is namespaced)
 */
function __autoload($class)
{
    require_once CLASSES_DIR . str_replace("\\", "/", $class) . '.php';
}
// __autoload( $class )
$db = new DBInterface("localhost", "project_tracker", "project_tracker", "project_tracker");
/**
 * Initiates a PHP session if a session ID cookie is found.
 */
if (array_key_exists(session_name(), $_COOKIE)) {
    try {
        session_start();
        $loginSession = $db->readLoginSession($_COOKIE[session_name()]);
    } catch (Exception $ex) {
        // Unable to restore session for some reason
        session_destroy();
        unset($loginSession);
    }
}
function doUnauthorizedRedirect()
{
    while (@ob_end_clean()) {
    }
    header("Location: " . BASE_URL . "page.php/unauthorized");
    exit;
}
// doUnauthorizedRedirect()
function doUnauthenticatedRedirect()