diff --git a/base/database.php b/base/database.php index 55fef28..c2c3d02 100644 --- a/base/database.php +++ b/base/database.php @@ -10,12 +10,12 @@ class DB extends PDO { $conn = null; try { - $dataAccess = parse_ini_file($config, true); + $dataAccess = parse_ini_file($config, true)["ZEDAT"]; $conn = new PDO( - "mysql:host={$dataAccess["ZEDAT"]["host"]};dbname={$dataAccess["ZEDAT"]["database"]};charset={$dataAccess["ZEDAT"]["charset"]}", - $dataAccess["ZEDAT"]["user"], - $dataAccess["ZEDAT"]["passwd"], + "mysql:host={$dataAccess["host"]};dbname={$dataAccess["database"]};charset={$dataAccess["charset"]}", + $dataAccess["user"], + $dataAccess["passwd"], [ PDO::ATTR_PERSISTENT => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, diff --git a/homework/1/colourSelector/index.php b/homework/1/colourSelector/index.php index d60346d..b0fa381 100644 --- a/homework/1/colourSelector/index.php +++ b/homework/1/colourSelector/index.php @@ -12,6 +12,7 @@ // PHP include_once "../../../base/settings.php"; include_once "../../../base/headers.php"; + Headers::html(); if (!isset($_COOKIE["validation"])) { setcookie("validation", "false"); @@ -25,8 +26,6 @@ unset($colour); } } - - Headers::html(); ?> diff --git a/homework/1/themeSwitcher/index.php b/homework/1/themeSwitcher/index.php index 6ccd8e0..5d8dec2 100644 --- a/homework/1/themeSwitcher/index.php +++ b/homework/1/themeSwitcher/index.php @@ -12,6 +12,7 @@ // PHP include_once "../../../base/settings.php"; include_once "../../../base/headers.php"; + Headers::html(); if (isset($_POST["theme"])) { $theme = $_POST["theme"]; @@ -21,8 +22,6 @@ } else if (isset($_COOKIE["theme"])) { $theme = $_COOKIE["theme"]; } - - Headers::html(); ?> diff --git a/tasks/counter/index.php b/tasks/counter/index.php index 14a3fda..f271c81 100644 --- a/tasks/counter/index.php +++ b/tasks/counter/index.php @@ -12,6 +12,7 @@ // PHP include_once "../../base/settings.php"; include_once "../../base/headers.php"; + Headers::html(); $fh = fopen("./data/counter.txt", "r+"); if (flock($fh, LOCK_EX)) { @@ -27,8 +28,6 @@ } flock($fh, LOCK_UN); fclose($fh); - - Headers::html(); ?>