Subversion Repositories computer_asset_manager_v2

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php
2
 
20 rodolico 3
   /*
4
    * The order of the following are important. Since we are storing 
5
    * an instantiation of the Auth class, we must load it BEFORE
6
    * starting the session, so it can be deserialized properly
7
    * So, we have to set the include paths, then include Auth.class.php
8
    * before session_start is run.
9
    */
10
   // add ./include and ./library to the include path
11
   ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . __DIR__ . '/include' . PATH_SEPARATOR . __DIR__ . '/library' ); 
21 rodolico 12
 
1 rodolico 13
   include_once( 'Auth.class.php' );
21 rodolico 14
   include_once( 'DebugFile.class.php' );
15
   include_once( 'functions.php' );
20 rodolico 16
   session_start();
21 rodolico 17
 
18
   global $DEBUG;
19
 
20
   if ( isset( $_SESSION['DEBUG'] ) )
21
      $DEBUG = new DebugFile( $_SESSION['DEBUG']['File Name'], $_SESSION['DEBUG']['level'] );
1 rodolico 22
 
21 rodolico 23
   if ( ! isset( $loggingIn ) ) {
22 rodolico 24
      $DEBUG->writeLog( 3, 'not logging in', __FILE__ );
21 rodolico 25
      // when login has not been called, call it, otherwise just make the DB connection
22 rodolico 26
      if ( ! isset( $_SESSION[ 'authorization information' ]['user_id'] ) ) {
27
         $DEBUG->writeLog( 3, 'Not logged in, going to login page', __FILE__ );
21 rodolico 28
         header( "Location: login.html?message=Error%20you%20must%20log%20in%20first" );
29
      } else {
22 rodolico 30
         $DEBUG->writeLog( 3, 'Logged in, making DB connection', __FILE__ );
21 rodolico 31
         DBQuery::connect( $_SESSION['database'] );
32
      }
33
   }
20 rodolico 34
 
1 rodolico 35
 
36
?>