| 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"); // This should be the connection to your main database
session_start();
if (!isset($_SESSION['my_id'])) {
header("Location: login.php");
exit();
}
/**
* FIX: Use absolute naming (database.table)
* Replace 'cranebule_moviedb' with the actual name of your subscription database
*/
$userDB = "cranebule_userdb";
$movieDB = "snclipdb"; // <--- CHANGE THIS to your actual movie/sub database name
$query = "SELECT u.my_id, u.email, s.subscription_status, s.expiry_date
FROM $userDB.cb_userstb u
LEFT JOIN $movieDB.cine_subscriptiontb s ON u.my_id = s.my_id
ORDER BY u.id DESC";
$users = mysqli_query($con, $query);
if (!$users) {
die("Query Failed: " . mysqli_error($con));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Management | CINEVAA</title>
<style>
:root {
--primary: #e50914;
--bg: #0a0a0a;
--card-bg: #141414;
--text: #fff;
--border: #262626;
--success: #10b981;
--warning: #f59e0b;
}
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); margin: 0; display: flex; }
/* Sidebar */
.sidebar { width: 240px; background: #000; height: 100vh; position: fixed; border-right: 1px solid var(--border); padding: 20px; }
.logo { color: var(--primary); font-size: 22px; font-weight: 800; text-decoration: none; display: block; margin-bottom: 40px; }
.nav-link { display: block; color: #888; text-decoration: none; padding: 12px 15px; border-radius: 8px; margin-bottom: 5px; }
.nav-link:hover, .nav-link.active { background: var(--card-bg); color: var(--primary); }
/* Content */
.main-content { margin-left: 240px; padding: 40px; width: 100%; }
.content-card { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: #1a1a1a; padding: 15px; font-size: 13px; color: #888; text-transform: uppercase; }
td { padding: 15px; border-bottom: 1px solid var(--border); font-size: 14px; }
/* Status Pills */
.status-pill {
padding: 4px 10px;
border-radius: 20px;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.status-active { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-expired { background: rgba(229, 9, 20, 0.1); color: var(--primary); }
.status-none { background: rgba(136, 136, 136, 0.1); color: #888; }
.user-id { font-family: 'Courier New', monospace; color: var(--warning); font-weight: bold; }
</style>
</head>
<body>
<div class="sidebar">
<a href="admin_dashboard.php" class="logo">CINEVAA ADMIN</a>
<a href="admin_dashboard.php" class="nav-link">Movies List</a>
<a href="users_list.php" class="nav-link active">Manage Users</a>
<a href="upload_movie.php" class="nav-link">Upload New</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">
<h2 style="margin-bottom: 30px;">User Management</h2>
<div class="content-card">
<table>
<thead>
<tr>
<th>Member ID</th>
<th>Email Address</th>
<th>Status</th>
<th>Expiration Date</th>
<th>Days Left</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($users)):
// Calculate days remaining
$daysLeft = "N/A";
$statusClass = "status-none";
$statusText = "No Plan";
if ($row['expiry_date']) {
$remaining = strtotime($row['expiry_date']) - time();
$days = ceil($remaining / (60 * 60 * 24));
if ($days > 0 && $row['subscription_status'] == 'active') {
$daysLeft = $days . " Days";
$statusClass = "status-active";
$statusText = "Active";
} else {
$daysLeft = "0 Days";
$statusClass = "status-expired";
$statusText = "Expired";
}
}
?>
<tr>
<td><span class="user-id">#<?php echo $row['my_id']; ?></span></td>
<td><?php echo $row['email']; ?></td>
<td><span class="status-pill <?php echo $statusClass; ?>"><?php echo $statusText; ?></span></td>
<td><?php echo ($row['expiry_date']) ? date('M d, Y', strtotime($row['expiry_date'])) : '---'; ?></td>
<td><?php echo $daysLeft; ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>