288 lines
8.1 KiB
PHP
288 lines
8.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
@ini_set('display_errors', '1');
|
|
@error_reporting(E_ALL);
|
|
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['user'])) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
|
|
$user = $_SESSION['user'];
|
|
|
|
if (isset($_GET['action']) && $_GET['action'] === 'logout') {
|
|
session_destroy();
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
|
|
// Get stats
|
|
$userDesignsDir = '/home/blari/executor/workspace/users_data/' . session_id() . '/designs';
|
|
$userImagesDir = '/home/blari/executor/workspace/users_data/' . session_id() . '/images';
|
|
$userVideosDir = '/home/blari/executor/workspace/users_data/' . session_id() . '/videos';
|
|
|
|
$designCount = count(glob($userDesignsDir . '/*'));
|
|
$imageCount = count(glob($userImagesDir . '/*'));
|
|
$videoCount = count(glob($userVideosDir . '/*'));
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>Dashboard - Digital Marketing Suite</title>
|
|
<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;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--bg-color: #f8f9fa;
|
|
--sidebar-bg: #ffffff;
|
|
--text-color: #343a40;
|
|
--heading-color: #212529;
|
|
--primary-color: #6a11cb;
|
|
--primary-color-dark: #5a0fb3;
|
|
--border-color: #dee2e6;
|
|
--card-bg: #ffffff;
|
|
--shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
|
}
|
|
body {
|
|
margin: 0;
|
|
font-family: 'Inter', sans-serif;
|
|
background-color: var(--bg-color);
|
|
color: var(--text-color);
|
|
display: flex;
|
|
}
|
|
.sidebar {
|
|
width: 260px;
|
|
background-color: var(--sidebar-bg);
|
|
border-right: 1px solid var(--border-color);
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100vh;
|
|
position: fixed;
|
|
box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
|
|
}
|
|
.sidebar-header {
|
|
padding: 1.5rem;
|
|
font-size: 1.5rem;
|
|
font-weight: 700;
|
|
color: var(--primary-color);
|
|
border-bottom: 1px solid var(--border-color);
|
|
text-align: center;
|
|
}
|
|
.sidebar-nav {
|
|
flex-grow: 1;
|
|
list-style: none;
|
|
padding: 1rem 0;
|
|
margin: 0;
|
|
}
|
|
.sidebar-nav a {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 1rem 1.5rem;
|
|
text-decoration: none;
|
|
color: var(--text-color);
|
|
font-weight: 500;
|
|
transition: background-color 0.2s, color 0.2s;
|
|
border-left: 3px solid transparent;
|
|
}
|
|
.sidebar-nav a:hover, .sidebar-nav a.active {
|
|
background-color: #f1eafa;
|
|
color: var(--primary-color);
|
|
border-left-color: var(--primary-color);
|
|
}
|
|
.sidebar-footer {
|
|
padding: 1.5rem;
|
|
border-top: 1px solid var(--border-color);
|
|
}
|
|
.logout-btn {
|
|
display: block;
|
|
width: 100%;
|
|
padding: 0.8rem;
|
|
border: none;
|
|
border-radius: 8px;
|
|
background: var(--primary-color);
|
|
color: #ffffff;
|
|
font-size: 1rem;
|
|
font-weight: 700;
|
|
cursor: pointer;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
transition: background-color 0.2s;
|
|
}
|
|
.logout-btn:hover {
|
|
background-color: var(--primary-color-dark);
|
|
}
|
|
.main-content {
|
|
margin-left: 260px;
|
|
flex-grow: 1;
|
|
padding: 3rem;
|
|
}
|
|
header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 2rem;
|
|
}
|
|
h1 {
|
|
font-size: 2.2rem;
|
|
font-weight: 700;
|
|
color: var(--heading-color);
|
|
}
|
|
.stats-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1.5rem;
|
|
margin-bottom: 2.5rem;
|
|
}
|
|
.stat-card {
|
|
background-color: var(--card-bg);
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
border: 1px solid var(--border-color);
|
|
box-shadow: var(--shadow);
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.stat-card .icon {
|
|
font-size: 2rem;
|
|
margin-right: 1rem;
|
|
padding: 0.8rem;
|
|
border-radius: 50%;
|
|
color: #fff;
|
|
}
|
|
.stat-card:nth-child(1) .icon { background-color: #6a11cb; }
|
|
.stat-card:nth-child(2) .icon { background-color: #2575fc; }
|
|
.stat-card:nth-child(3) .icon { background-color: #ff6b6b; }
|
|
.stat-card .value {
|
|
font-size: 2rem;
|
|
font-weight: 700;
|
|
}
|
|
.stat-card .label {
|
|
font-size: 0.9rem;
|
|
color: #6c757d;
|
|
}
|
|
.grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
gap: 2rem;
|
|
}
|
|
.card {
|
|
background-color: var(--card-bg);
|
|
border-radius: 12px;
|
|
padding: 2rem;
|
|
border: 1px solid var(--border-color);
|
|
box-shadow: var(--shadow);
|
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
}
|
|
.card:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
|
|
}
|
|
.card h3 {
|
|
margin: 0 0 0.75rem;
|
|
font-size: 1.3rem;
|
|
font-weight: 700;
|
|
color: var(--heading-color);
|
|
}
|
|
.card p {
|
|
margin: 0 0 1.5rem;
|
|
font-size: 1rem;
|
|
line-height: 1.6;
|
|
}
|
|
.card .btn {
|
|
display: inline-block;
|
|
padding: 0.7rem 1.5rem;
|
|
border-radius: 8px;
|
|
background-color: var(--primary-color);
|
|
color: #ffffff;
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
transition: background-color 0.2s;
|
|
}
|
|
.card .btn:hover {
|
|
background-color: var(--primary-color-dark);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="sidebar">
|
|
<div class="sidebar-header">
|
|
Digital Suite
|
|
</div>
|
|
<nav class="sidebar-nav">
|
|
<a href="dashboard.php" class="active">Dashboard</a>
|
|
<a href="post-generator.php">Post Generator</a>
|
|
|
|
<a href="image-library.php">Image Library</a>
|
|
<a href="video-library.php">Video Library</a>
|
|
<a href="website-builder.php">Website Builder</a>
|
|
<a href="analytics.php">Analytics</a>
|
|
<a href="settings.php">Settings</a>
|
|
</nav>
|
|
<div class="sidebar-footer">
|
|
<a href="?action=logout" class="logout-btn">Logout</a>
|
|
</div>
|
|
</div>
|
|
|
|
<main class="main-content">
|
|
<header>
|
|
<h1>Dashboard</h1>
|
|
<div>Welcome, <strong><?= htmlspecialchars($user['business_name']) ?></strong>!</div>
|
|
</header>
|
|
|
|
<div class="stats-grid">
|
|
<div class="stat-card">
|
|
<div class="icon">🎨</div>
|
|
<div>
|
|
<div class="value"><?= $designCount ?></div>
|
|
<div class="label">Designs Created</div>
|
|
</div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<div class="icon">🖼️</div>
|
|
<div>
|
|
<div class="value"><?= $imageCount ?></div>
|
|
<div class="label">Images Uploaded</div>
|
|
</div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<div class="icon">🎬</div>
|
|
<div>
|
|
<div class="value"><?= $videoCount ?></div>
|
|
<div class="label">Videos Uploaded</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid">
|
|
<div class="card">
|
|
<h3>AI Post Generator</h3>
|
|
<p>Create engaging social media posts from text descriptions.</p>
|
|
<a href="post-generator.php" class="btn">Generate Post</a>
|
|
</div>
|
|
<div class="card">
|
|
<h3>Image Library</h3>
|
|
<p>Upload and manage your image assets for your marketing campaigns.</p>
|
|
<a href="image-library.php" class="btn">View Images</a>
|
|
</div>
|
|
<div class="card">
|
|
<h3>Video Library</h3>
|
|
<p>Upload and manage your video assets for your marketing campaigns.</p>
|
|
<a href="video-library.php" class="btn">View Videos</a>
|
|
</div>
|
|
<div class="card">
|
|
<h3>AI Website Builder</h3>
|
|
<p>Generate a professional website for your business in just a few clicks.</p>
|
|
<a href="website-builder.php" class="btn">Build Your Site</a>
|
|
</div>
|
|
</div>
|
|
|
|
</main>
|
|
</body>
|
|
</html>
|