74 lines
3.8 KiB
PHP
74 lines
3.8 KiB
PHP
<?php
|
|
if (session_status() === PHP_SESSION_NONE) {
|
|
session_start();
|
|
}
|
|
require_once __DIR__ . '/db/config.php';
|
|
$current_page = basename($_SERVER['PHP_SELF']);
|
|
|
|
// Auth Check for most pages (excluding login/register)
|
|
$public_pages = ['login.php', 'register.php'];
|
|
if (!isset($_SESSION['user_id']) && !in_array($current_page, $public_pages)) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
|
|
// Read project preview data from environment
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'MSP Customer Success Platform for onboarding and management.';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>MSP Connect | Customer Success Platform</title>
|
|
|
|
<?php if ($projectDescription): ?>
|
|
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<?php endif; ?>
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar">
|
|
<a href="index.php" class="navbar-brand">
|
|
<i class="bi bi-shield-check"></i> MSP Connect
|
|
</a>
|
|
<div class="nav-links">
|
|
<?php if (isset($_SESSION['user_id'])): ?>
|
|
<?php if ($_SESSION['role'] === 'superadmin'): ?>
|
|
<a href="superadmin_dashboard.php" class="nav-link <?php echo $current_page == 'superadmin_dashboard.php' ? 'active' : ''; ?>">Superadmin</a>
|
|
<a href="manage_msps.php" class="nav-link <?php echo $current_page == 'manage_msps.php' ? 'active' : ''; ?>">MSPs</a>
|
|
<a href="plans.php" class="nav-link <?php echo $current_page == 'plans.php' ? 'active' : ''; ?>">Plans</a>
|
|
<?php else: ?>
|
|
<a href="index.php" class="nav-link <?php echo $current_page == 'index.php' ? 'active' : ''; ?>">Dashboard</a>
|
|
<a href="customers.php" class="nav-link <?php echo $current_page == 'customers.php' ? 'active' : ''; ?>">Customers</a>
|
|
<a href="templates.php" class="nav-link <?php echo $current_page == 'templates.php' ? 'active' : ''; ?>">Templates</a>
|
|
<a href="#" class="nav-link">QBRs</a>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div>
|
|
<?php if (isset($_SESSION['user_id'])): ?>
|
|
<span style="font-size: 0.875rem; color: var(--text-muted); margin-right: 1rem;">
|
|
<?php echo htmlspecialchars($_SESSION['user_name']); ?>
|
|
(<?php echo strtoupper($_SESSION['role']); ?>)
|
|
</span>
|
|
<a href="logout.php" class="btn btn-outline" style="padding: 0.25rem 0.5rem;" title="Logout"><i class="bi bi-box-arrow-right"></i></a>
|
|
<?php else: ?>
|
|
<a href="login.php" class="nav-link d-inline-block">Login</a>
|
|
<a href="register.php" class="btn btn-primary btn-sm ms-2">Register MSP</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</nav>
|