From 84bbfc7291b99c737747690bfdf17abbd02ceb2d Mon Sep 17 00:00:00 2001 From: Thomas CHAZOT Date: Fri, 6 Jan 2023 17:02:00 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'api-rest/index.php?= =?UTF-8?q?'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api-rest/index.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/api-rest/index.php b/api-rest/index.php index 988871d..8872acd 100644 --- a/api-rest/index.php +++ b/api-rest/index.php @@ -17,17 +17,18 @@ // ------ // Comment faire un fichier .htaccess pour protéger ce fichier ????????? // ------ - //$ini_array= parse_ini_file("config.ini"); + $ini_array= parse_ini_file("config.ini"); - $dsn = "mysql:host=". getenv("DB_SERVER").";dbname=". getenv("MYSQL_DATABASE"); - $username = getenv("MYSQL_USER_TOM"); - $password = getenv("MYSQL_PASSWORD_TOM"); + //$dsn = "mysql:host=". getenv("DB_SERVER").";dbname=". getenv("MYSQL_DATABASE"); + //$username = getenv("MYSQL_USER_TOM"); + //$password = getenv("MYSQL_PASSWORD_TOM"); - echo $dsn . " " . $username . " " . $password . " "; + //echo $dsn . " " . $username . " " . $password . " "; // Initializing Database try{ - $database = new DatabaseConnection($dsn,$username,$password); + //$database = new DatabaseConnection($dsn,$username,$password); + $database = new DatabaseConnection($ini_array['dsn'],$ini_array['username'],$ini_array['password']); } catch (PDOException $e) { echo "ERROR connection"; header("HTTP/1.0 ".$e->getMessage());