Only start the session and create session variables when not running in CLI
This commit is contained in:
		
							parent
							
								
									498a031cab
								
							
						
					
					
						commit
						8a38d3ce9f
					
				
							
								
								
									
										50
									
								
								header.php
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								header.php
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -9,41 +9,43 @@ require 'functions.php';
 | 
			
		|||
// be named "require_login() and take no parameters
 | 
			
		||||
require 'authfunctions.php';
 | 
			
		||||
 | 
			
		||||
// Start the session
 | 
			
		||||
session_name(SESSIONCOMICS);
 | 
			
		||||
session_start();
 | 
			
		||||
if ( php_sapi_name() != "cli" ) {
 | 
			
		||||
    // Start the session
 | 
			
		||||
    session_name(SESSIONCOMICS);
 | 
			
		||||
    session_start();
 | 
			
		||||
 | 
			
		||||
// This session variable is TRUE when successfully logged in
 | 
			
		||||
// If set to true, and using default authentication, no login will be required
 | 
			
		||||
if ( !isset($_SESSION['validated']) ) {
 | 
			
		||||
    // This session variable is TRUE when successfully logged in
 | 
			
		||||
    // If set to true, and using default authentication, no login will be required
 | 
			
		||||
    if ( !isset($_SESSION['validated']) ) {
 | 
			
		||||
    $_SESSION['validated'] = false;
 | 
			
		||||
}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
// This session variable is set to the current browsing folder.
 | 
			
		||||
// It is relative to the COMICSDIR constant defined in variables.php
 | 
			
		||||
if ( !isset($_SESSION['compath']) ) {
 | 
			
		||||
    // This session variable is set to the current browsing folder.
 | 
			
		||||
    // It is relative to the COMICSDIR constant defined in variables.php
 | 
			
		||||
    if ( !isset($_SESSION['compath']) ) {
 | 
			
		||||
    $_SESSION['compath'] = '/';
 | 
			
		||||
}
 | 
			
		||||
if ( $_SESSION['compath'] == "" ) $_SESSION['compath'] = "/";
 | 
			
		||||
    }
 | 
			
		||||
    if ( $_SESSION['compath'] == "" ) $_SESSION['compath'] = "/";
 | 
			
		||||
 | 
			
		||||
// This session variable is set to the current comic in Base64
 | 
			
		||||
if ( !isset($_SESSION['comfile']) ) {
 | 
			
		||||
    // This session variable is set to the current comic in Base64
 | 
			
		||||
    if ( !isset($_SESSION['comfile']) ) {
 | 
			
		||||
    $_SESSION['comfile'] = "";
 | 
			
		||||
}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
// Initialize the hash session variable used for SSO
 | 
			
		||||
// Set the hash to the passed in value if it exists
 | 
			
		||||
if ( !isset($_SESSION['hash']) ) {
 | 
			
		||||
    // Initialize the hash session variable used for SSO
 | 
			
		||||
    // Set the hash to the passed in value if it exists
 | 
			
		||||
    if ( !isset($_SESSION['hash']) ) {
 | 
			
		||||
    $_SESSION['hash'] = "";
 | 
			
		||||
}
 | 
			
		||||
if ( isset($_REQUEST['hash']) ) {
 | 
			
		||||
    }
 | 
			
		||||
    if ( isset($_REQUEST['hash']) ) {
 | 
			
		||||
    $_SESSION['hash'] = $_REQUEST['hash'];
 | 
			
		||||
}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
// Sorting for folders.
 | 
			
		||||
// Valid values (from constants): SORTBYNAME, SORTBYDATE
 | 
			
		||||
if ( !isset($_SESSION['sortorder']) ) {
 | 
			
		||||
    // Sorting for folders.
 | 
			
		||||
    // Valid values (from constants): SORTBYNAME, SORTBYDATE
 | 
			
		||||
    if ( !isset($_SESSION['sortorder']) ) {
 | 
			
		||||
    $_SESSION['sortorder'] = SORTBYDATE;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Make our PDO database connection which will be used in all scripts
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user