rework config-file
parent
aa65626bb4
commit
fab37f47bb
|
@ -1,2 +1,2 @@
|
|||
webdata/connection.php
|
||||
webdata/config.php
|
||||
temp/
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
$config["db"]["host"] = "localhost";
|
||||
$config["db"]["user"] = "user";
|
||||
$config["db"]["pass"] = "password";
|
||||
$config["db"]["database"] = "database";
|
||||
|
||||
$config["general"]["projectRoot"] = "/groceries";
|
||||
|
||||
?>
|
|
@ -1,3 +0,0 @@
|
|||
<?php
|
||||
$db = new mysqli("localhost","user","password","database");
|
||||
?>
|
|
@ -4,12 +4,22 @@ ini_set('display_startup_errors', 1);
|
|||
error_reporting(E_ALL);
|
||||
|
||||
|
||||
require_once 'config.php';
|
||||
|
||||
$projectRoot = $config["general"]["projectRoot"];
|
||||
|
||||
function database(){
|
||||
require 'connection.php';
|
||||
|
||||
global $config;
|
||||
|
||||
$db = new mysqli($config["db"]["host"], $config["db"]["user"], $config["db"]["pass"], $config["db"]["database"]);
|
||||
|
||||
if($db->connect_error){
|
||||
die("Connection failed: " . $blogdb->connect_error);
|
||||
die("Connection failed: " . $db->connect_error);
|
||||
}
|
||||
|
||||
return $db;
|
||||
}
|
||||
|
||||
function checkLogin(){
|
||||
|
||||
}
|
Loading…
Reference in New Issue