From d1000772cc42247ba76625ef310e530988ad7a30 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Thu, 9 Apr 2026 08:36:30 +0200 Subject: [PATCH 1/5] Fix gitignore per spostamento in cartella src --- .gitignore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1a806e8..4e5364a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -img/* -!img/example/ -!img/logo.png \ No newline at end of file +src/img/* +!src/img/example/ +!src/img/logo.png \ No newline at end of file From fa83895b92601863779877f4b600b3149a5a233e Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Thu, 9 Apr 2026 08:37:20 +0200 Subject: [PATCH 2/5] Spostamento DB base in cartella a parte --- base_db.sql => assets/db/base_db.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename base_db.sql => assets/db/base_db.sql (100%) diff --git a/base_db.sql b/assets/db/base_db.sql similarity index 100% rename from base_db.sql rename to assets/db/base_db.sql From 5f23a26c340736c9229e108911b52bb96eedd5ab Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Fri, 10 Apr 2026 12:43:46 +0200 Subject: [PATCH 3/5] Aggiunta pulsante modifica password --- src/account.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/account.php b/src/account.php index eca6fcb..f664fa6 100644 --- a/src/account.php +++ b/src/account.php @@ -49,7 +49,8 @@ if ($result === false) {

Account di

Nome completo:


- Elimina account + Modifica password + Elimina account

From 8b37e33a9fd23205728fbf47981f6336a20f489b Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Fri, 10 Apr 2026 12:48:54 +0200 Subject: [PATCH 4/5] Implementazione pagina cambio password --- src/account.php | 4 +- src/account/passwordChange.php | 90 ++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 src/account/passwordChange.php diff --git a/src/account.php b/src/account.php index f664fa6..7d48394 100644 --- a/src/account.php +++ b/src/account.php @@ -49,8 +49,8 @@ if ($result === false) {

Account di

Nome completo:


- Modifica password - Elimina account + Modifica password + Elimina account

diff --git a/src/account/passwordChange.php b/src/account/passwordChange.php new file mode 100644 index 0000000..ac49b8b --- /dev/null +++ b/src/account/passwordChange.php @@ -0,0 +1,90 @@ + + + + + + Cambio Password - TechStore + + + + prepare($sql)) { + $stmt->bind_param("i", $_SESSION['id']); + $stmt->execute(); + $stmt->bind_result($hashed_password); + $stmt->fetch(); + $stmt->close(); + + if (!password_verify($current_password, $hashed_password)) { + $error = 'La password corrente non è corretta.'; + } else { + $new_hashed = password_hash($new_password, PASSWORD_DEFAULT); + $sql_update = "UPDATE Users SET Password = ? WHERE UserID = ?"; + if ($stmt_update = $conn->prepare($sql_update)) { + $stmt_update->bind_param("si", $new_hashed, $_SESSION['id']); + $stmt_update->execute(); + $stmt_update->close(); + + $message = 'Password aggiornata con successo.'; + } else { + $error = 'Errore durante l\'aggiornamento della password.'; + } + } + } else { + $error = 'Errore nel database.'; + } + } + } + ?> + +
+

Cambio Password

+ +

+ +

+ + +

+ +

+ + + +
+ + +
+ + +
+ + +

Torna al mio account

+
+ + \ No newline at end of file From 5551ee423507796784e170e36b0614c439eae476 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Fri, 10 Apr 2026 13:02:36 +0200 Subject: [PATCH 5/5] Implementazione eliminazione utente --- src/account/delete.php | 92 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/account/delete.php diff --git a/src/account/delete.php b/src/account/delete.php new file mode 100644 index 0000000..e085c89 --- /dev/null +++ b/src/account/delete.php @@ -0,0 +1,92 @@ + + + + + + Elimina Account - TechStore + + + + prepare($sql)) { + $stmt->bind_param("i", $_SESSION['id']); + $stmt->execute(); + $stmt->bind_result($hashed_password); + $stmt->fetch(); + $stmt->close(); + + if (!password_verify($current_password, $hashed_password)) { + $error = 'La password non è corretta.'; + } else { + // Elimina gli ordini associati all'utente + $sql_delete_order_items = "DELETE oi FROM OrderItems oi JOIN Orders o ON oi.OrderID = o.OrderID WHERE o.UserID = ?"; + $stmt_delete_order_items = $conn->prepare($sql_delete_order_items); + $stmt_delete_order_items->bind_param("i", $_SESSION['id']); + $stmt_delete_order_items->execute(); + $stmt_delete_order_items->close(); + + $sql_delete_orders = "DELETE FROM Orders WHERE UserID = ?"; + $stmt_delete_orders = $conn->prepare($sql_delete_orders); + $stmt_delete_orders->bind_param("i", $_SESSION['id']); + $stmt_delete_orders->execute(); + $stmt_delete_orders->close(); + + $sql_delete_user = "DELETE FROM Users WHERE UserID = ?"; + $stmt_delete_user = $conn->prepare($sql_delete_user); + $stmt_delete_user->bind_param("i", $_SESSION['id']); + $stmt_delete_user->execute(); + $stmt_delete_user->close(); + + session_unset(); + session_destroy(); + + $message = 'Il tuo account è stato eliminato insieme a tutti i tuoi ordini.'; + } + } else { + $error = 'Errore nel database.'; + } + } + } + ?> + +
+

Elimina Account

+

Questa operazione cancellerà il tuo account e tutti gli ordini associati. Inserisci la tua password per confermare.

+ + +

+ +

+ + +

+ +

+ + + +
+ + +

Annulla e torna al mio account

+
+ + \ No newline at end of file