+
+
+
+
+
+
+
+
+
+
Seu Portal Completo de Pickleball
@@ -167,6 +179,43 @@
+
+
+
diff --git a/signup.php b/signup.php
new file mode 100644
index 0000000..b70f662
--- /dev/null
+++ b/signup.php
@@ -0,0 +1,58 @@
+prepare('SELECT id FROM users WHERE email = ?');
+ $stmt->execute([$email]);
+ if ($stmt->fetch()) {
+ $_SESSION['error_message'] = 'Este e-mail já está cadastrado.';
+ header('Location: index.php');
+ exit;
+ }
+
+ // Insert new user
+ $hashedPassword = password_hash($password, PASSWORD_DEFAULT);
+ $stmt = $pdo->prepare('INSERT INTO users (username, email, password, role, birth_date) VALUES (?, ?, ?, ?, ?)');
+ $stmt->execute([$fullName, $email, $hashedPassword, 'atleta', $birthDate]);
+
+ $_SESSION['success_message'] = 'Cadastro realizado com sucesso! Você já pode fazer o login.';
+ header('Location: index.php');
+ exit;
+
+ } catch (PDOException $e) {
+ $_SESSION['error_message'] = 'Erro no banco de dados. Tente novamente mais tarde.';
+ // In a real app, you would log this error: error_log($e->getMessage());
+ header('Location: index.php');
+ exit;
+ }
+}