dodanie csrf, oauth 2, dockerfile

This commit is contained in:
Marcin Cieślikowski
2026-03-16 10:43:19 +01:00
parent 56c7ecff6d
commit df448ea7c1
26 changed files with 916 additions and 318 deletions
+5
View File
@@ -16,6 +16,7 @@ if (!$order) {
// 1. OBSŁUGA ZMIANY STATUSU ARCHIWUM
if (isset($_POST['archive_action'])) {
requireCsrfToken();
$new_archive_status = $order['is_archived'] ? 0 : 1;
$update_arch = $pdo->prepare("UPDATE " . DB_PREFIX . "orders SET is_archived = ? WHERE id = ?");
@@ -33,6 +34,7 @@ if (isset($_POST['archive_action'])) {
// 2. OBSŁUGA DODAWANIA KOMENTARZA
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['add_comment'])) {
requireCsrfToken();
$comment_text = trim($_POST['comment_text'] ?? '');
if (!empty($comment_text)) {
@@ -51,6 +53,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['add_comment'])) {
// 3. OBSŁUGA STANDARDOWEJ EDYCJI
if ($_SERVER["REQUEST_METHOD"] == "POST" && !isset($_POST['archive_action']) && !isset($_POST['add_comment'])) {
requireCsrfToken();
$product_name = trim($_POST['product_name'] ?? '');
$part_number = trim($_POST['part_number'] ?? '');
$quantity = (int)$_POST['quantity'];
@@ -170,6 +173,7 @@ $comments = $comm_stmt->fetchAll();
<div class="card-body">
<?php echo $message; ?>
<form method="POST">
<?php echo csrfInput(); ?>
<div class="mb-3 p-2 bg-success bg-opacity-10 border border-success rounded">
<label class="form-label small fw-bold text-success"><i class="bi bi-building"></i> Firma kupująca</label>
@@ -262,6 +266,7 @@ $comments = $comm_stmt->fetchAll();
</div>
<div class="card-body bg-light">
<form method="POST" class="mb-3">
<?php echo csrfInput(); ?>
<div class="input-group shadow-sm">
<textarea name="comment_text" class="form-control" rows="2" placeholder="Wpisz nowy komentarz..." required></textarea>
<button type="submit" name="add_comment" class="btn btn-primary px-3"><i class="bi bi-send"></i></button>