Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 0360176

Browse files
bug fix
1 parent 57930cf commit 0360176

File tree

10 files changed

+25
-10
lines changed

10 files changed

+25
-10
lines changed

src/bulk_action.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
foreach ($params as $param) {
3131
$row = $db->where('id', $param);
3232
$row = $db->getOne("{$type}_qrcodes");
33-
$files[] = SAVED_QRCODE_FOLDER . $row['qrcode'];
33+
@$files[] = SAVED_QRCODE_FOLDER . $row['qrcode'];
3434
}
3535

3636
$zip = new ZipArchive();
@@ -41,7 +41,7 @@
4141
$zip->open($relative_dir, ZipArchive::CREATE);
4242

4343
foreach ($files as $file) {
44-
$download_file = file_get_contents($file, true);
44+
$download_file = @file_get_contents($file, true);
4545
$zip->addFromString(basename($file), $download_file);
4646
}
4747

src/config/config.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
ini_set('display_errors', 'On');
77
define('BASE_PATH', dirname(dirname(__FILE__)));
88
define('CURRENT_PAGE', basename($_SERVER['REQUEST_URI']));
9+
define('SCRIPT_NAME', ltrim(dirname($_SERVER['SCRIPT_NAME']), '/'));
10+
11+
if(SCRIPT_NAME === "")
12+
define('SCRIPT_FOLDER', "");
13+
else
14+
define('SCRIPT_FOLDER', "/" . SCRIPT_NAME);
915

1016
require_once BASE_PATH . '/lib/MysqliDb/MysqliDb.php';
1117
require_once BASE_PATH . '/helpers/helpers.php';
@@ -14,7 +20,7 @@
1420
//You can change the folder where the qr code will be saved
1521
define('SAVED_QRCODE_FOLDER', './saved_qrcode/');
1622
define('SAVED_QRCODE_DIRECTORY', BASE_PATH.'/saved_qrcode/');
17-
define('SAVED_QRCODE_URL', base_url().'/saved_qrcode/');
23+
define('SAVED_QRCODE_URL', base_url(). SCRIPT_FOLDER .'/saved_qrcode/');
1824

1925
//You can change the page name for the redirect and the search parameter (the default is "id")
2026
define('READ_PATH', base_url().'/read.php?id=');

src/dist/js/custom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@
459459
}
460460

461461
$.ajax({
462-
url: window.location.origin + '/bulk_action.php',
462+
url: './bulk_action.php',
463463
method: "POST",
464464
data: JSON.stringify(data),
465465
dataType: "json",

src/forms/form_dynamic_add.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,7 @@
120120
</div>
121121
</div>
122122
</div>
123+
<?php } else { ?>
124+
<input type="hidden" name="id_owner" value="<?php echo $_SESSION["user_id"];?>"/>
123125
<?php } ?>
124126
</fieldset>

src/forms/form_dynamic_edit.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
</select>
5959
</div>
6060
</div>
61+
<?php } else { ?>
62+
<input type="hidden" name="id_owner" value="<?php echo $_SESSION["user_id"];?>"/>
6163
<?php } ?>
6264

6365

src/forms/form_static_edit.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
</select>
3232
</div>
3333
</div>
34+
<?php } else { ?>
35+
<input type="hidden" name="id_owner" value="<?php echo $_SESSION["user_id"];?>"/>
3436
<?php } ?>
3537

3638
<input type="hidden" name="id" value="<?php echo $static_qrcode['id'];?>"/>

src/forms/qrcode_options.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,7 @@
104104
</div>
105105
</div>
106106
</div>
107+
<?php } else { ?>
108+
<input type="hidden" name="id_owner" value="<?php echo $_SESSION["user_id"];?>"/>
107109
<?php } ?>
108110
<br>

src/includes/footer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<strong>Copyright &copy; <?php echo date("Y");?> <a href="#">PHP Qrcode Generator</a> - </strong>
1010
All rights reserved by Giandonato Inverso.
1111
<div class="float-right d-none d-sm-inline-block">
12-
<b>Version</b> 2.2.0
12+
<b>Version</b> 2.2.1
1313
</div>
1414
</footer>
1515
</div>

src/index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
$db = getDbInstance();
77

88
//Get Dynamic qr code rows
9-
if($_SESSION['type'] !== 'super') {
9+
if($_SESSION['type'] !== 'super') {
1010
$db->where("id_owner", $_SESSION['user_id']);
1111
$db->orWhere ("id_owner", NULL, 'IS');
1212
}
1313
$numQrcode_dynamic = $db->getValue("dynamic_qrcodes", "count(*)");
1414

1515
//Get Static qr code rows
16-
if($_SESSION['type'] !== 'super') {
16+
if($_SESSION['type'] !== 'super') {
1717
$db->where("id_owner", $_SESSION['user_id']);
1818
$db->orWhere ("id_owner", NULL, 'IS');
1919
}
@@ -22,7 +22,7 @@
2222
$total = $numQrcode_dynamic + $numQrcode_static;
2323

2424
//Get Total scan
25-
if($_SESSION['type'] !== 'super') {
25+
if($_SESSION['type'] !== 'super') {
2626
$db->where("id_owner", $_SESSION['user_id']);
2727
$db->orWhere ("id_owner", NULL, 'IS');
2828
}
@@ -32,8 +32,8 @@
3232
//I initialize the variables that will contain the daily values to 0 otherwise in the foreach loop they will be reset every time
3333

3434
//Get the number of DYNAMIC qr code created in 7 days and total scan
35-
if($_SESSION['type'] !== 'super')
36-
$createdQrcode_dynamic = $db->query("select `created_at`, `scan` from " . DATABASE_PREFIX . "dynamic_qrcodes where `created_at` > curdate()-7 AND (`id_owner`=" . $_SESSION['user_id'] . " OR `id_owner` IS NULL);");
35+
if($_SESSION['type'] !== 'super')
36+
$createdQrcode_dynamic = $db->query("select `created_at`, `scan` from " . DATABASE_PREFIX . "dynamic_qrcodes where `created_at` > curdate()-7 AND (`id_owner`= " . $_SESSION['user_id'] . " OR `id_owner` IS NULL);");
3737
else
3838
$createdQrcode_dynamic = $db->query("select `created_at`, `scan` from ".DATABASE_PREFIX."dynamic_qrcodes where `created_at` > curdate()-7;");
3939

src/login.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
}
3535

3636
$_SESSION['user_logged_in'] = TRUE;
37+
$_SESSION['user_id'] = $row['id'];
3738
$_SESSION['type'] = $row['type'];
3839
header('Location: index.php');
3940
exit;

0 commit comments

Comments
 (0)