| 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 ) ) {
  | 
        
        
            | 
            | 
           24 | 
                 // when login has not been called, call it, otherwise just make the DB connection
  | 
        
        
            | 
            | 
           25 | 
                 if ( ! isset( $_SESSION[ 'authorization information' ]->user_id ) ) {
  | 
        
        
            | 
            | 
           26 | 
                    header( "Location: login.html?message=Error%20you%20must%20log%20in%20first" );
  | 
        
        
            | 
            | 
           27 | 
                 } else {
  | 
        
        
            | 
            | 
           28 | 
                    DBQuery::connect( $_SESSION['database'] );
  | 
        
        
            | 
            | 
           29 | 
                 }
  | 
        
        
            | 
            | 
           30 | 
              }
  | 
        
        
           | 20 | 
           rodolico | 
           31 | 
              | 
        
        
           | 1 | 
           rodolico | 
           32 | 
              | 
        
        
            | 
            | 
           33 | 
           ?>
  |