| Server IP : 127.0.0.1 / Your IP : 216.73.216.48 Web Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT DESKTOP-3H4FHQJ 10.0 build 19045 (Windows 10) AMD64 User : win 10 ( 0) PHP Version : 8.2.12 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/xampp/htdocs-coblaa/Cinevaa/ |
Upload File : |
<?php
include("db.php");
include("con_db.php");
session_start();
if (!isset($_SESSION['my_id'])) {
header("Location: login.php");
exit();
}
// 1. Most Watched Movies
$top_movies = mysqli_query($con, "SELECT title, view_count FROM sn_moviestb ORDER BY view_count DESC LIMIT 5");
// 2. Category Distribution
$cat_stats = mysqli_query($con, "SELECT movieCategory, COUNT(*) as count FROM sn_moviestb GROUP BY movieCategory");
// 3. Subscription Revenue (Assuming $10 per active sub)
$active_subs_count = mysqli_fetch_assoc(mysqli_query($con, "SELECT COUNT(*) as total FROM cine_subscriptiontb WHERE subscription_status='active'"))['total'];
$estimated_revenue = $active_subs_count * 10;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CINEVAA Analytics</title>
<style>
:root { --primary: #e50914; --bg: #0a0a0a; --card: #141414; --gold: #d4af37; --border: #262626; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: #fff; margin: 0; display: flex; }
.sidebar { width: 240px; background: #000; height: 100vh; position: fixed; border-right: 1px solid var(--border); padding: 20px; }
.main-content { margin-left: 240px; padding: 40px; width: 100%; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin-top: 30px; }
.card { background: var(--card); border: 1px solid var(--border); padding: 25px; border-radius: 12px; }
/* Simple CSS Bar Chart */
.bar-container { margin-top: 20px; }
.bar-row { margin-bottom: 15px; }
.bar-label { font-size: 13px; color: #888; margin-bottom: 5px; display: flex; justify-content: space-between; }
.bar-outer { background: #222; height: 8px; border-radius: 4px; overflow: hidden; }
.bar-inner { background: var(--primary); height: 100%; border-radius: 4px; }
.bar-inner.gold { background: var(--gold); }
.rev-text { font-size: 48px; font-weight: 800; color: #10b981; margin: 10px 0; }
.nav-link { display: block; color: #888; text-decoration: none; padding: 12px 15px; border-radius: 8px; margin-bottom: 5px; }
.nav-link.active { background: var(--card); color: var(--primary); }
</style>
</head>
<body>
<div class="sidebar">
<h2 style="color:var(--primary)">CINEVAA</h2>
<a href="index" class="nav-link">Home</a>
<a href="admin_movie_dash.php" class="nav-link">Movies List</a>
<a href="users_list.php" class="nav-link">Manage Users</a>
<a href="admin_analytics.php" class="nav-link active">Analytics</a>
<hr style="border:0; border-top:1px solid var(--border); margin:20px 0;">
<a href="logout.php" class="nav-link">Sign Out</a>
</div>
<div class="main-content">
<h1>Platform Insights</h1>
<div class="grid">
<div class="card">
<h3>Estimated Monthly Revenue</h3>
<p style="color:#888; font-size:12px;">Based on $10.00/subscription</p>
<div class="rev-text">$<?php echo number_format($estimated_revenue, 2); ?></div>
<p style="color: #10b981;">↑ 12% from last month</p>
</div>
<div class="card">
<h3>Most Watched Movies</h3>
<div class="bar-container">
<?php while($m = mysqli_fetch_assoc($top_movies)):
$percent = ($m['view_count'] > 0) ? ($m['view_count'] / 1000) * 100 : 0; // Mock scaling
?>
<div class="bar-row">
<div class="bar-label">
<span><?php echo $m['title']; ?></span>
<span><?php echo number_format($m['view_count']); ?> views</span>
</div>
<div class="bar-outer"><div class="bar-inner" style="width: <?php echo $percent; ?>%"></div></div>
</div>
<?php endwhile; ?>
</div>
</div>
<div class="card">
<h3>Library by Category</h3>
<div class="bar-container">
<?php while($c = mysqli_fetch_assoc($cat_stats)): ?>
<div class="bar-row">
<div class="bar-label">
<span><?php echo $c['movieCategory']; ?></span>
<span><?php echo $c['count']; ?> Titles</span>
</div>
<div class="bar-outer"><div class="bar-inner gold" style="width: <?php echo ($c['count'] / 20) * 100; ?>%"></div></div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
</div>
</body>
</html>