From 48f60ce0c337120ed4c24c5a7d8a0ed1784ac326 Mon Sep 17 00:00:00 2001 From: Dorian HODIN Date: Tue, 29 Nov 2022 13:33:44 +0100 Subject: [PATCH] config.php update --- Sources/db_script/sql/location.sql | 18 ------------------ Sources/php_script/script/config.php | 14 +++++++------- 2 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 Sources/db_script/sql/location.sql diff --git a/Sources/db_script/sql/location.sql b/Sources/db_script/sql/location.sql deleted file mode 100644 index 5f9d7a4..0000000 --- a/Sources/db_script/sql/location.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE DATABASE IF NOT EXISTS positiondaflmusic; - -CREATE USER $(USER)@'%' IDENTIFIED BY $(PASSWORD); - -GRANT ALL PRIVILEGES ON * . * TO $(USER)@'%'; - -FLUSH PRIVILEGES; - -CREATE TABLE gps ( - id varchar(30) PRIMARY KEY, - latitude double NOT NULL, - longitude double NOT NULL, - idMusic varchar(100) NOT NULL, - dateLog datetime NOT NULL -); - - - diff --git a/Sources/php_script/script/config.php b/Sources/php_script/script/config.php index eefa9dd..10e0879 100644 --- a/Sources/php_script/script/config.php +++ b/Sources/php_script/script/config.php @@ -3,18 +3,18 @@ function connection(): bool|int|mysqli { - $username = $_ENV["USER"]; //Get the username - $host = $_ENV["HOST"]; //Get the url of the database + $username = $_ENV["USER"]; //Get the username + $host = $_ENV["HOST"]; //Get the url of the database $password = $_ENV["PASSWORD"]; //Get the password for the user selected - $db_name = $_ENV["DATABASE"]; //Get the name of the database + $db_name = $_ENV["DATABASE"]; //Get the name of the database - try { //Try to connect to the database + try { //Try to connect to the database - return mysqli_connect($host, $username, $password,$db_name); //Connecting to database + return mysqli_connect($host, $username, $password,$db_name); //Connecting to database - }catch (mysqli_sql_exception) { //If the connection failed + }catch (mysqli_sql_exception) { //If the connection failed - return -1; //Send a return code as -1, so insertAndMakeListUser.php can know if the connection is successful + return -1; //Send a return code as -1, so insertAndMakeListUser.php can know if the connection is successful } }