From e99e97cae2a69b3f86a3a9c70eba6433516f7a25 Mon Sep 17 00:00:00 2001 From: Pascal <56366987+chilluniverse@users.noreply.github.com> Date: Fri, 14 Oct 2022 01:26:06 +0200 Subject: [PATCH 1/3] DATABASE_HOST In the docker-compose.yml is the Database_Host defined as "mariadb". If Host is not changed in the environment.php to "mariadb" as well the setup will fail --- qrcode/config/environment.php.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qrcode/config/environment.php.example b/qrcode/config/environment.php.example index 9980cdd..70640ed 100644 --- a/qrcode/config/environment.php.example +++ b/qrcode/config/environment.php.example @@ -17,7 +17,7 @@ if(is_string($docker_cid)) { define('DATABASE_PREFIX', Getenv('DATABASE_PREFIX')); define('DATABASE_CHARSET', Getenv('DATABASE_CHARSET')); } else { - define('DATABASE_HOST', "localhost"); + define('DATABASE_HOST', "mariadb"); define('DATABASE_PORT', "3306"); define('DATABASE_NAME', "qrcode"); define('DATABASE_USER', "root"); From e448066176d46b7ff80295e579e5304f78398061 Mon Sep 17 00:00:00 2001 From: Ayham Al-Ali Date: Wed, 25 Jan 2023 20:47:52 +0300 Subject: [PATCH 2/3] Fix DB Prefix --- read.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/read.php b/read.php index eac1ab0..f13e48d 100644 --- a/read.php +++ b/read.php @@ -11,14 +11,16 @@ include 'qrcode/config/config.php'; +$prefix = DATABASE_PREFIX; + //Get DB instance. function is defined in config.php $db = getDbInstance(); $get_id = htmlspecialchars($_GET['id'], ENT_QUOTES, 'UTF-8'); // I take the id through the GET method -$state = $db->query("SELECT state FROM dynamic_qrcodes WHERE identifier='$get_id'"); -$link = $db->query("SELECT link FROM dynamic_qrcodes WHERE identifier='$get_id'"); +$state = $db->query("SELECT state FROM " . $prefix . "dynamic_qrcodes WHERE identifier='$get_id'"); +$link = $db->query("SELECT link FROM " . $prefix . "dynamic_qrcodes WHERE identifier='$get_id'"); -$update = $db->query("UPDATE dynamic_qrcodes SET scan=scan+1 WHERE identifier='$get_id'"); +$update = $db->query("UPDATE " . $prefix . "dynamic_qrcodes SET scan=scan+1 WHERE identifier='$get_id'"); if($state[0]['state'] == 'enable'){ echo ''; // Page refresh with the link obtained From c87a99a067eea9c58671e0a898d71ca85675f4a6 Mon Sep 17 00:00:00 2001 From: Giandonato Inverso <70962472+giandonatoinverso@users.noreply.github.com> Date: Wed, 25 Jan 2023 18:51:10 +0100 Subject: [PATCH 3/3] Update Dockerfile --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f011827..ec79d08 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ FROM php:7.4.21-apache -ARG APP_VERSION=v1.0.5 +ARG APP_VERSION=v1.0.6 RUN apt-get update && \ apt-get install -y --no-install-recommends less nano tini curl tar git zip unzip && \