From 921b30e47dd7464075dabe1b580dc7ab5cdc16cf Mon Sep 17 00:00:00 2001 From: Maurice Meyer Date: Fri, 21 Jul 2017 17:21:17 +0200 Subject: [PATCH] Fixed PHP Fatal error when config-user.php missing --- config/config-default.php | 6 +++++- lib/database.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/config-default.php b/config/config-default.php index fa8ad51..38bae70 100644 --- a/config/config-default.php +++ b/config/config-default.php @@ -25,4 +25,8 @@ $config['db_name'] = "pdnsmanager"; $config['nonce_lifetime'] = 15; //Number of rows in domain overview $config['domain_rows'] = 15; -require 'config-user.php'; + +// If config-user.php does not exist, redirect to the setup page +if(!(include 'config-user.php')) { + Header("Location: install.php"); +} diff --git a/lib/database.php b/lib/database.php index 3ca4790..b871cce 100644 --- a/lib/database.php +++ b/lib/database.php @@ -18,5 +18,5 @@ try { $db = new PDO($config['db_type'].":dbname=".$config['db_name'].";host=".$config['db_host'].";port=".strval($config['db_port']), $config['db_user'], $config['db_password']); } catch (PDOException $e) { - die("Connection to database failed"); + die("Connection to the database failed. There is an error in the database configuration."); }