<?php

require './core.php';

// Check if user is logged in
if (!isLogged()) {
    header('Location: ' . $urlPath->signin());
    exit;
}

// Get user details
$user_id = $_SESSION['user_id'];

$statement = $connect->prepare("SELECT * FROM users WHERE user_id = :user_id LIMIT 1");
$statement->execute(array(':user_id' => $user_id));
$userDetails = $statement->fetch();

if (!$userDetails) {
    header('Location: ' . $urlPath->signout());
    exit;
}

// Page title
$pageTitle = 'My Profile - ' . $translation['tr_1'];

require './views/profile.view.php';

?>
