Only start the session and create session variables when not running in CLI

This commit is contained in:
Junior 2023-08-22 14:45:18 -04:00
parent 498a031cab
commit 8a38d3ce9f

View File

@ -9,6 +9,7 @@ require 'functions.php';
// be named "require_login() and take no parameters // be named "require_login() and take no parameters
require 'authfunctions.php'; require 'authfunctions.php';
if ( php_sapi_name() != "cli" ) {
// Start the session // Start the session
session_name(SESSIONCOMICS); session_name(SESSIONCOMICS);
session_start(); session_start();
@ -45,6 +46,7 @@ if ( isset($_REQUEST['hash']) ) {
if ( !isset($_SESSION['sortorder']) ) { if ( !isset($_SESSION['sortorder']) ) {
$_SESSION['sortorder'] = SORTBYDATE; $_SESSION['sortorder'] = SORTBYDATE;
} }
}
// Make our PDO database connection which will be used in all scripts // Make our PDO database connection which will be used in all scripts
$globaldbh = new PDO("mysql:host=" . DBHOST . ";dbname=" . DBNAME, DBUSER, DBPASS); $globaldbh = new PDO("mysql:host=" . DBHOST . ";dbname=" . DBNAME, DBUSER, DBPASS);