This commit is contained in:
Giandonato Inverso
2023-10-17 00:41:15 +02:00
committed by giandonato.inverso@edempg.it
parent 15c84c0863
commit c9fa6abf06
10 changed files with 25 additions and 10 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
foreach ($params as $param) { foreach ($params as $param) {
$row = $db->where('id', $param); $row = $db->where('id', $param);
$row = $db->getOne("{$type}_qrcodes"); $row = $db->getOne("{$type}_qrcodes");
$files[] = SAVED_QRCODE_FOLDER . $row['qrcode']; @$files[] = SAVED_QRCODE_FOLDER . $row['qrcode'];
} }
$zip = new ZipArchive(); $zip = new ZipArchive();
@@ -41,7 +41,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$zip->open($relative_dir, ZipArchive::CREATE); $zip->open($relative_dir, ZipArchive::CREATE);
foreach ($files as $file) { foreach ($files as $file) {
$download_file = file_get_contents($file, true); $download_file = @file_get_contents($file, true);
$zip->addFromString(basename($file), $download_file); $zip->addFromString(basename($file), $download_file);
} }
+7 -1
View File
@@ -6,6 +6,12 @@ error_reporting(E_ALL);
ini_set('display_errors', 'On'); ini_set('display_errors', 'On');
define('BASE_PATH', dirname(dirname(__FILE__))); define('BASE_PATH', dirname(dirname(__FILE__)));
define('CURRENT_PAGE', basename($_SERVER['REQUEST_URI'])); define('CURRENT_PAGE', basename($_SERVER['REQUEST_URI']));
define('SCRIPT_NAME', ltrim(dirname($_SERVER['SCRIPT_NAME']), '/'));
if(SCRIPT_NAME === "")
define('SCRIPT_FOLDER', "");
else
define('SCRIPT_FOLDER', "/" . SCRIPT_NAME);
require_once BASE_PATH . '/lib/MysqliDb/MysqliDb.php'; require_once BASE_PATH . '/lib/MysqliDb/MysqliDb.php';
require_once BASE_PATH . '/helpers/helpers.php'; require_once BASE_PATH . '/helpers/helpers.php';
@@ -14,7 +20,7 @@ require_once BASE_PATH . '/helpers/helpers.php';
//You can change the folder where the qr code will be saved //You can change the folder where the qr code will be saved
define('SAVED_QRCODE_FOLDER', './saved_qrcode/'); define('SAVED_QRCODE_FOLDER', './saved_qrcode/');
define('SAVED_QRCODE_DIRECTORY', BASE_PATH.'/saved_qrcode/'); define('SAVED_QRCODE_DIRECTORY', BASE_PATH.'/saved_qrcode/');
define('SAVED_QRCODE_URL', base_url().'/saved_qrcode/'); define('SAVED_QRCODE_URL', base_url(). SCRIPT_FOLDER .'/saved_qrcode/');
//You can change the page name for the redirect and the search parameter (the default is "id") //You can change the page name for the redirect and the search parameter (the default is "id")
define('READ_PATH', base_url().'/read.php?id='); define('READ_PATH', base_url().'/read.php?id=');
+1 -1
View File
@@ -459,7 +459,7 @@
} }
$.ajax({ $.ajax({
url: window.location.origin + '/bulk_action.php', url: './bulk_action.php',
method: "POST", method: "POST",
data: JSON.stringify(data), data: JSON.stringify(data),
dataType: "json", dataType: "json",
+2
View File
@@ -120,5 +120,7 @@
</div> </div>
</div> </div>
</div> </div>
<?php } else { ?>
<input type="hidden" name="id_owner" value="<?php echo $_SESSION["user_id"];?>"/>
<?php } ?> <?php } ?>
</fieldset> </fieldset>
+2
View File
@@ -58,6 +58,8 @@
</select> </select>
</div> </div>
</div> </div>
<?php } else { ?>
<input type="hidden" name="id_owner" value="<?php echo $_SESSION["user_id"];?>"/>
<?php } ?> <?php } ?>
+2
View File
@@ -31,6 +31,8 @@
</select> </select>
</div> </div>
</div> </div>
<?php } else { ?>
<input type="hidden" name="id_owner" value="<?php echo $_SESSION["user_id"];?>"/>
<?php } ?> <?php } ?>
<input type="hidden" name="id" value="<?php echo $static_qrcode['id'];?>"/> <input type="hidden" name="id" value="<?php echo $static_qrcode['id'];?>"/>
+2
View File
@@ -104,5 +104,7 @@
</div> </div>
</div> </div>
</div> </div>
<?php } else { ?>
<input type="hidden" name="id_owner" value="<?php echo $_SESSION["user_id"];?>"/>
<?php } ?> <?php } ?>
<br> <br>
+1 -1
View File
@@ -9,7 +9,7 @@
<strong>Copyright &copy; <?php echo date("Y");?> <a href="#">PHP Qrcode Generator</a> - </strong> <strong>Copyright &copy; <?php echo date("Y");?> <a href="#">PHP Qrcode Generator</a> - </strong>
All rights reserved by Giandonato Inverso. All rights reserved by Giandonato Inverso.
<div class="float-right d-none d-sm-inline-block"> <div class="float-right d-none d-sm-inline-block">
<b>Version</b> 2.2.0 <b>Version</b> 2.2.1
</div> </div>
</footer> </footer>
</div> </div>
+5 -5
View File
@@ -6,14 +6,14 @@ require_once 'includes/auth_validate.php';
$db = getDbInstance(); $db = getDbInstance();
//Get Dynamic qr code rows //Get Dynamic qr code rows
if($_SESSION['type'] !== 'super') { if($_SESSION['type'] !== 'super') {
$db->where("id_owner", $_SESSION['user_id']); $db->where("id_owner", $_SESSION['user_id']);
$db->orWhere ("id_owner", NULL, 'IS'); $db->orWhere ("id_owner", NULL, 'IS');
} }
$numQrcode_dynamic = $db->getValue("dynamic_qrcodes", "count(*)"); $numQrcode_dynamic = $db->getValue("dynamic_qrcodes", "count(*)");
//Get Static qr code rows //Get Static qr code rows
if($_SESSION['type'] !== 'super') { if($_SESSION['type'] !== 'super') {
$db->where("id_owner", $_SESSION['user_id']); $db->where("id_owner", $_SESSION['user_id']);
$db->orWhere ("id_owner", NULL, 'IS'); $db->orWhere ("id_owner", NULL, 'IS');
} }
@@ -22,7 +22,7 @@ $numQrcode_static = $db->getValue("static_qrcodes", "count(*)");
$total = $numQrcode_dynamic + $numQrcode_static; $total = $numQrcode_dynamic + $numQrcode_static;
//Get Total scan //Get Total scan
if($_SESSION['type'] !== 'super') { if($_SESSION['type'] !== 'super') {
$db->where("id_owner", $_SESSION['user_id']); $db->where("id_owner", $_SESSION['user_id']);
$db->orWhere ("id_owner", NULL, 'IS'); $db->orWhere ("id_owner", NULL, 'IS');
} }
@@ -32,8 +32,8 @@ $numScan = $db->getOne(DATABASE_PREFIX."dynamic_qrcodes", "sum(scan) as numScan"
//I initialize the variables that will contain the daily values to 0 otherwise in the foreach loop they will be reset every time //I initialize the variables that will contain the daily values to 0 otherwise in the foreach loop they will be reset every time
//Get the number of DYNAMIC qr code created in 7 days and total scan //Get the number of DYNAMIC qr code created in 7 days and total scan
if($_SESSION['type'] !== 'super') if($_SESSION['type'] !== 'super')
$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);"); $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);");
else else
$createdQrcode_dynamic = $db->query("select `created_at`, `scan` from ".DATABASE_PREFIX."dynamic_qrcodes where `created_at` > curdate()-7;"); $createdQrcode_dynamic = $db->query("select `created_at`, `scan` from ".DATABASE_PREFIX."dynamic_qrcodes where `created_at` > curdate()-7;");
+1
View File
@@ -34,6 +34,7 @@ if (isset($_COOKIE['series_id']) && isset($_COOKIE['remember_token']))
} }
$_SESSION['user_logged_in'] = TRUE; $_SESSION['user_logged_in'] = TRUE;
$_SESSION['user_id'] = $row['id'];
$_SESSION['type'] = $row['type']; $_SESSION['type'] = $row['type'];
header('Location: index.php'); header('Location: index.php');
exit; exit;