From 4ac9cd811ada1d108e74df57b72f2346582ee6fd Mon Sep 17 00:00:00 2001 From: Giandonato Inverso <70962472+giandonatoinverso@users.noreply.github.com> Date: Tue, 8 Sep 2020 17:59:49 +0200 Subject: [PATCH] Add files via upload --- read.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 read.php diff --git a/read.php b/read.php new file mode 100644 index 0000000..eac1ab0 --- /dev/null +++ b/read.php @@ -0,0 +1,29 @@ + +* @copyright Copyright (c) 2020-2021 +* @license https://opensource.org/licenses/MIT MIT License +* @link https://github.com/giandonatoinverso/PHP-Dynamic-Qr-code +* @version 1.0 +*/ + +include 'qrcode/config/config.php'; + +//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'"); + +$update = $db->query("UPDATE dynamic_qrcodes SET scan=scan+1 WHERE identifier='$get_id'"); + + if($state[0]['state'] == 'enable'){ + echo ''; // Page refresh with the link obtained + echo 'Loading...'; // You can include a custom page to display during the redirect + } + else + echo 'Disabled link'; +?>