dodanie csrf, oauth 2, dockerfile

This commit is contained in:
Marcin Cieślikowski
2026-03-16 10:43:19 +01:00
parent 56c7ecff6d
commit 9023b9a5ed
26 changed files with 872 additions and 274 deletions
+18 -8
View File
@@ -3,7 +3,17 @@ require_once 'includes/db.php';
require_once 'includes/auth.php';
checkAuth();
function sanitizeCsvCell($value) {
$value = (string)$value;
if ($value !== '' && preg_match('/^[=\+\-@]/', $value) === 1) {
return "'" . $value;
}
return $value;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['order_ids'])) {
requireCsrfToken();
$ids = $_POST['order_ids'];
// Tworzenie znaków zapytania do zapytania SQL (np. ?, ?, ?)
@@ -31,16 +41,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['order_ids'])) {
foreach ($orders as $o) {
fputcsv($output, [
$o['id'],
$o['product_name'],
$o['part_number'],
sanitizeCsvCell($o['product_name']),
sanitizeCsvCell($o['part_number']),
$o['quantity'],
$o['purchase_place'],
sanitizeCsvCell($o['purchase_place']),
number_format($o['price_per_unit'], 2, ',', ''), // Cena z przecinkiem dla Excela
$o['delivery_date'],
$o['recipient'],
$o['delivery_address'],
$o['status'],
$o['notes']
sanitizeCsvCell($o['delivery_date']),
sanitizeCsvCell($o['recipient']),
sanitizeCsvCell($o['delivery_address']),
sanitizeCsvCell($o['status']),
sanitizeCsvCell($o['notes'])
], ';');
}