Rev 21 | Rev 26 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<?php
/*
* The order of the following are important. Since we are storing
* an instantiation of the Auth class, we must load it BEFORE
* starting the session, so it can be deserialized properly
* So, we have to set the include paths, then include Auth.class.php
* before session_start is run.
*/
// add ./include and ./library to the include path
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . __DIR__ . '/include' . PATH_SEPARATOR . __DIR__ . '/library' );
include_once( 'Auth.class.php' );
include_once( 'DebugFile.class.php' );
include_once( 'functions.php' );
session_start();
global $DEBUG;
if ( isset( $_SESSION['DEBUG'] ) )
$DEBUG = new DebugFile( $_SESSION['DEBUG']['File Name'], $_SESSION['DEBUG']['level'] );
if ( ! isset( $loggingIn ) ) {
$DEBUG->writeLog( 3, 'not logging in', __FILE__ );
// when login has not been called, call it, otherwise just make the DB connection
if ( ! isset( $_SESSION[ 'authorization information' ]['user_id'] ) ) {
$DEBUG->writeLog( 3, 'Not logged in, going to login page', __FILE__ );
header( "Location: login.html?message=Error%20you%20must%20log%20in%20first" );
} else {
$DEBUG->writeLog( 3, 'Logged in, making DB connection', __FILE__ );
DBQuery::connect( $_SESSION['database'] );
}
}
?>