From aadf344e63a608ee7bf82e334c1fabd1c4e9fd02 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 10:22:28 +0200 Subject: [PATCH 01/10] Aggiunta pagina form login --- index.php | 4 ++-- login.php | 19 +++++++++++++++++++ style.css | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 login.php diff --git a/index.php b/index.php index 20d6f9e..b36b436 100644 --- a/index.php +++ b/index.php @@ -22,8 +22,8 @@ if ($result === false) {
- - + +
diff --git a/login.php b/login.php new file mode 100644 index 0000000..59c85e8 --- /dev/null +++ b/login.php @@ -0,0 +1,19 @@ + + + + + + Login - TechStore + + + +
+

Login

+ +
+ +

+ +
+ + \ No newline at end of file diff --git a/style.css b/style.css index a741172..e9f380a 100644 --- a/style.css +++ b/style.css @@ -35,4 +35,53 @@ } .product-card button:hover { background-color: #0056b3; +} + +/* Stili per il form di login */ +form { + max-width: 400px; + margin: 50px auto; + padding: 20px; + border: 1px solid #ddd; + border-radius: 8px; + background-color: #f9f9f9; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +form h2 { + text-align: center; + margin-bottom: 20px; + color: #333; +} + +form label { + display: block; + margin-bottom: 5px; + font-weight: bold; + color: #555; +} + +form input[type="text"], +form input[type="password"] { + width: 100%; + padding: 10px; + margin-bottom: 15px; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; +} + +form button { + width: 100%; + padding: 10px; + background-color: #28a745; + color: white; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 16px; +} + +form button:hover { + background-color: #218838; } \ No newline at end of file From df3414fd206341aac70808f94cd8da904ea178aa Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 10:27:18 +0200 Subject: [PATCH 02/10] Aggiunta link pagina registrazione --- login.php | 1 + 1 file changed, 1 insertion(+) diff --git a/login.php b/login.php index 59c85e8..e0ac5ba 100644 --- a/login.php +++ b/login.php @@ -14,6 +14,7 @@

+

Non hai un account? Registrati

\ No newline at end of file From e7651454669826195d29b8616982ae839ed868e9 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 10:31:45 +0200 Subject: [PATCH 03/10] Aggiunta pagina registrazione --- register.php | 24 ++++++++++++++++++++++++ style.css | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 register.php diff --git a/register.php b/register.php new file mode 100644 index 0000000..16b04de --- /dev/null +++ b/register.php @@ -0,0 +1,24 @@ + + + + + + Login - TechStore + + + +
+

Login

+ +
+ +
+ +
+ +

+ +

Hai giĆ  un account? Accedi

+
+ + \ No newline at end of file diff --git a/style.css b/style.css index e9f380a..65faa83 100644 --- a/style.css +++ b/style.css @@ -62,7 +62,8 @@ form label { } form input[type="text"], -form input[type="password"] { +form input[type="password"], +form input[type="email"] { width: 100%; padding: 10px; margin-bottom: 15px; From 9f7f97ec501435edbbd8130fcff418c56e73f119 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 10:35:21 +0200 Subject: [PATCH 04/10] Fix argomento `lang` in `login.php` --- login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/login.php b/login.php index e0ac5ba..63cce26 100644 --- a/login.php +++ b/login.php @@ -1,5 +1,5 @@ - + From c738593153c6f5729aaecf7ac5ae9ba06e119067 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 10:36:41 +0200 Subject: [PATCH 05/10] Fix intestazione e titolo pagina registrazione --- register.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/register.php b/register.php index 16b04de..6aee768 100644 --- a/register.php +++ b/register.php @@ -3,12 +3,12 @@ - Login - TechStore + Registrazione - TechStore
-

Login

+

Registrazione


From a3c6464702101642e8af2f37fa2e889fb2da554d Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 10:39:45 +0200 Subject: [PATCH 06/10] Aggiunta campo cognome in tabella DB Users --- base_db.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/base_db.sql b/base_db.sql index 933a55f..180f6e2 100644 --- a/base_db.sql +++ b/base_db.sql @@ -6,6 +6,7 @@ USE TechStore; CREATE TABLE Users( UserID INTEGER PRIMARY KEY AUTO_INCREMENT, Name VARCHAR(32), + Surname VARCHAR(32), Email VARCHAR(256), Password VARCHAR(255) ); From bca0b0fba19a7b523b0ea1d9d7e86f92a46f36f8 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 10:43:24 +0200 Subject: [PATCH 07/10] Fix form autenticazione --- login.php | 4 ++-- register.php | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/login.php b/login.php index 63cce26..9a1883c 100644 --- a/login.php +++ b/login.php @@ -9,8 +9,8 @@

Login

- -
+ +


diff --git a/register.php b/register.php index 6aee768..c0f0626 100644 --- a/register.php +++ b/register.php @@ -9,8 +9,10 @@

Registrazione

- -
+ +
+ +

From 8b6044329017e47fd1f997bde2550e02798416ba Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 11:05:19 +0200 Subject: [PATCH 08/10] Aggiunta logica registrazione utente --- register.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/register.php b/register.php index c0f0626..6f9194d 100644 --- a/register.php +++ b/register.php @@ -1,3 +1,7 @@ + + @@ -7,6 +11,26 @@ + prepare($sql)){ + $stmt->bind_param("ssss", $name, $surname, $email, $password); + + $name = $_POST['name']; + $surname = $_POST['surname']; + $email = $_POST['email']; + $password = password_hash($_POST['password'], PASSWORD_DEFAULT); + $stmt->execute(); + + echo "

Registrazione avvenuta con successo! Accedi

"; + } + else{ + echo "Errore: " . $conn->error; + } + } + ?> +

Registrazione

From 22e1ba32453b7cf6f93bef92dd0672f2b2759f19 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 11:18:58 +0200 Subject: [PATCH 09/10] Implementata logica sessioni --- index.php | 8 +++++++- login.php | 37 +++++++++++++++++++++++++++++++++++++ logout.php | 6 ++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 logout.php diff --git a/index.php b/index.php index b36b436..8ca89a9 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,5 @@ TechStore
- + + Benvenuto, + + + +
diff --git a/login.php b/login.php index 9a1883c..0bef6fb 100644 --- a/login.php +++ b/login.php @@ -7,6 +7,43 @@ + prepare($sql)) { + $stmt->bind_param("s", $email); + $stmt->execute(); + $stmt->store_result(); + + if ($stmt->num_rows > 0) { + $stmt->bind_result($name, $hashed_password); + $stmt->fetch(); + + if (password_verify($password, $hashed_password)) { + $_SESSION['user'] = $name; + header('Location: index.php'); + exit(); + } else { + $error = 'Credenziali errate.'; + } + } else { + $error = 'Credenziali errate.'; + } + + $stmt->close(); + } else { + $error = 'Errore nel database.'; + } + } + ?>

Login

diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..2ac2507 --- /dev/null +++ b/logout.php @@ -0,0 +1,6 @@ + \ No newline at end of file From dbc3316560c35315c5330b359d39cdf7338932e0 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 1 Apr 2026 11:22:54 +0200 Subject: [PATCH 10/10] Cambio posizionamento tasto "Logout" --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 8ca89a9..c565034 100644 --- a/index.php +++ b/index.php @@ -25,8 +25,8 @@ if ($result === false) {
- Benvenuto, + Benvenuto,