<?php
require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../middleware/user_auth.php';

$user_id     = $_SESSION['user_id'];
$first_name  = $_POST['first_name'] ?? "";
$last_name   = $_POST['last_name'] ?? "";
$email       = $_POST['email'] ?? "";

$stmt = $conn->prepare("
    UPDATE fxhai_users 
    SET user_nicename=?, display_name=?, user_email=? 
    WHERE ID=?
");
$stmt->bind_param("sssi", $first_name, $last_name, $email, $user_id);
$stmt->execute();

header("Location: account.php?saved=1");
exit;
