From dec2fdf60e664ac94c040c04d7e1e76c2afcd234 Mon Sep 17 00:00:00 2001 From: solocla Date: Tue, 6 Oct 2026 11:46:44 +0200 Subject: [PATCH] fixed certificate --- public/userprofiledoc.php | 100 +++++++++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 7 deletions(-) diff --git a/public/userprofiledoc.php b/public/userprofiledoc.php index 34a658a..b5b1275 100644 --- a/public/userprofiledoc.php +++ b/public/userprofiledoc.php @@ -30,10 +30,17 @@ if ( $file = $_FILES['fileToUpload']; $documentDescription = trim($_POST['documentDescription'] ?? ''); - $expiryDate = trim($_POST['expiryDate'] ?? ''); + $expiryInput = trim($_POST['expiryDate'] ?? ''); - if ($documentDescription === '' || $expiryDate === '') { + // Conversione GG/MM/AAAA -> AAAA-MM-GG per il database + $expiryObj = DateTime::createFromFormat('!d/m/Y', $expiryInput); + $expiryValid = $expiryObj && $expiryObj->format('d/m/Y') === $expiryInput; + $expiryDate = $expiryValid ? $expiryObj->format('Y-m-d') : ''; + + if ($documentDescription === '' || $expiryInput === '') { $uploadFeedback = ['type' => 'error', 'text' => 'Descrizione e data di scadenza sono obbligatorie.']; + } elseif (!$expiryValid) { + $uploadFeedback = ['type' => 'error', 'text' => 'Data di scadenza non valida. Usa il formato GG/MM/AAAA.']; } elseif ($file['size'] > $maxBytes) { $uploadFeedback = ['type' => 'error', 'text' => 'Il file supera la dimensione massima di 16 MB.']; } else { @@ -110,12 +117,33 @@ $documents = $stmtDocs->fetchAll(); @@ -374,7 +460,7 @@ $documents = $stmtDocs->fetchAll(); - + Apri @@ -416,7 +502,7 @@ $documents = $stmtDocs->fetchAll();
- +