From 9e5c078155c50d92c51657fe4caaac411465b602 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 15 Apr 2017 09:15:06 +0200 Subject: [PATCH] Don't redirect if cli --- include/initialize.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/initialize.inc.php b/include/initialize.inc.php index b459c7d..135ddda 100644 --- a/include/initialize.inc.php +++ b/include/initialize.inc.php @@ -29,9 +29,11 @@ session_start(); error_reporting("E_ALL"); ini_set("display_errors", "on"); //echo $_SERVER["REQUEST_URI"]; exit; -if(!isset($_SESSION['userID']) && (explode("?", $_SERVER["REQUEST_URI"])[0] != "/index.php" && $_SERVER["REQUEST_URI"] != "/")) { - header("location:index.php"); - exit; +if(php_sapi_name() !== 'cli' ) { + if (!isset($_SESSION['userID']) && (explode("?", $_SERVER["REQUEST_URI"])[0] != "/index.php" && $_SERVER["REQUEST_URI"] != "/")) { + header("location:index.php"); + exit; + } } require_once "config.inc.php";