forked from giandonatoinverso/PHP-Dynamic-Qr-code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread.php
29 lines (24 loc) · 1.12 KB
/
read.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
* PHP Dynamic Qr code
*
* @author Giandonato Inverso <[email protected]>
* @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 '<meta http-equiv="refresh" content="0; URL='.$link[0]['link'].'" />'; // Page refresh with the link obtained
echo 'Loading...'; // You can include a custom page to display during the redirect
}
else
echo 'Disabled link';
?>