diff --git a/public/userdetails.php b/public/userdetails.php index 615f375..b0d49c0 100644 --- a/public/userdetails.php +++ b/public/userdetails.php @@ -46,7 +46,7 @@ function isOwnAvatarFile($name): bool function loadUser(PDO $pdo, int $id) { $stmt = $pdo->prepare( - "SELECT id, email, username, password, first_name, last_name, phone, address, + "SELECT id, email, password, first_name, last_name, phone, address, country_id, birthday, avatar, created_at FROM auth_users WHERE id = :id @@ -92,7 +92,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $action !== '') { /* ---------- Dati personali ---------- */ $firstName = trim($_POST['first_name'] ?? ''); $lastName = trim($_POST['last_name'] ?? ''); - $username = trim($_POST['username'] ?? ''); $phone = trim($_POST['phone'] ?? ''); $address = trim($_POST['address'] ?? ''); $birthdayInput = trim($_POST['birthday'] ?? ''); @@ -112,18 +111,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $action !== '') { } } - // Username facoltativo ma univoco - if ($username !== '') { - if (!preg_match('/^[A-Za-z0-9._-]{3,50}$/', $username)) { - $errors[] = 'Lo username può contenere lettere, numeri, punto, trattino e underscore (da 3 a 50 caratteri).'; - } else { - $chk = $pdo->prepare("SELECT 1 FROM auth_users WHERE username = :u AND id <> :id LIMIT 1"); - $chk->execute([':u' => $username, ':id' => $iduserlogin]); - if ($chk->fetchColumn()) { - $errors[] = 'Questo username è già usato da un altro utente.'; - } - } - } // Telefono facoltativo if ($phone !== '' && !preg_match('/^[0-9+\s().\/-]{6,30}$/', $phone)) { @@ -159,8 +146,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $action !== '') { if (empty($errors)) { $sql = "UPDATE auth_users SET first_name = :first_name, - last_name = :last_name, - username = :username, + last_name = :last_name, phone = :phone, address = :address, birthday = :birthday, @@ -171,7 +157,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $action !== '') { $ok = $stmt->execute([ ':first_name' => $firstName, ':last_name' => $lastName, - ':username' => $username !== '' ? $username : null, ':phone' => $phone !== '' ? $phone : null, ':address' => $address !== '' ? $address : null, ':birthday' => $birthdayDb, @@ -191,7 +176,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $action !== '') { $postedProfile = array_merge($user, [ 'first_name' => $firstName, 'last_name' => $lastName, - 'username' => $username, 'phone' => $phone, 'address' => $address, 'country_id' => $countryInput, @@ -992,7 +976,7 @@ function renderFeedback(?array $fb): void
-
+
@@ -1003,13 +987,6 @@ function renderFeedback(?array $fb): void L'email serve per l'accesso e non si può modificare da qui. Per cambiarla contatta la segreteria.
-
-
- - -
-