64 lines
2.5 KiB
PHP
64 lines
2.5 KiB
PHP
<?php
|
|
require_once __DIR__ . '/includes/init.php';
|
|
require_login();
|
|
|
|
$user_id = $_SESSION['user_id'];
|
|
$db = db();
|
|
|
|
// Fetch user data
|
|
$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$user_id]);
|
|
$user = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
// Fetch client data if client_id is available
|
|
$client = null;
|
|
if (!empty($user['client_id'])) {
|
|
$stmt = $db->prepare("SELECT * FROM clients WHERE id = ?");
|
|
$stmt->execute([$user['client_id']]);
|
|
$client = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
$page_title = t('profile_header');
|
|
|
|
require_once __DIR__ . '/includes/html_head.php';
|
|
require_once __DIR__ . '/includes/header.php';
|
|
?>
|
|
<div class="container mt-5">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3><?= t('profile_user_profile') ?></h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<?php if ($user): ?>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h4><?= t('profile_welcome') ?>, <?php echo htmlspecialchars($user['username']); ?></h4>
|
|
<ul class="list-group list-group-flush">
|
|
<li class="list-group-item">
|
|
<i class="fas fa-envelope"></i>
|
|
<strong><?= t('profile_email_address') ?>:</strong> <?php echo htmlspecialchars($user['email']); ?>
|
|
</li>
|
|
<?php if ($client): ?>
|
|
<li class="list-group-item">
|
|
<i class="fas fa-building"></i>
|
|
<strong><?= t('profile_client') ?>:</strong> <?php echo htmlspecialchars($client['name']); ?>
|
|
</li>
|
|
<?php endif; ?>
|
|
</ul>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h4><?= t('profile_password_management') ?></h4>
|
|
<p><?= t('profile_feature_in_preparation') ?></p>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="alert alert-danger" role="alert">
|
|
<?= t('profile_error_loading') ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
require_once __DIR__ . '/includes/footer.php';
|
|
?>
|