Sign Up
Already have an account? Login
prepare("SELECT COUNT(*) FROM users WHERE email = ?"); $stmt->execute([$email]); if ($stmt->fetchColumn() > 0) { $error = 'An account with this email already exists.'; } else { // Insert new user $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmt = $pdo->prepare("INSERT INTO users (email, password, role) VALUES (?, ?, 'user')"); if ($stmt->execute([$email, $hashed_password])) { $success = 'Account created successfully! You can now login.'; } else { $error = 'Failed to create account. Please try again.'; } } } catch (PDOException $e) { $error = 'Database error. Please try again later.'; // error_log($e->getMessage()); } } } require_once 'includes/header.php'; ?>
Already have an account? Login