Browse Source

Fixed PHP Fatal error when config-user.php missing

Maurice Meyer 8 years ago
parent
commit
921b30e47d
2 changed files with 6 additions and 2 deletions
  1. 5 1
      config/config-default.php
  2. 1 1
      lib/database.php

+ 5 - 1
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");
+}

+ 1 - 1
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.");
 }