static-variables / jweb /ac1 /src /api /generate-package-page.php
fellybikush's picture
Upload 99 files
0dff816 verified
raw
history blame
15.9 kB
<?php
session_start();
if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) {
header('Location: ../../index.php');
exit;
}
// Database connection
require_once '../../db.php';
// Get package name from URL
$package_name = isset($_GET['package']) ? urldecode($_GET['package']) : '';
if (empty($package_name)) {
die("Package not specified.");
}
// Get package details
$stmt = $pdo->prepare("SELECT * FROM products WHERE name = ?");
$stmt->execute([$package_name]);
$package = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$package) {
die("Package not found.");
}
// Check if user owns this package
$user_id = $_SESSION['user_id'];
$stmt = $pdo->prepare("SELECT * FROM user_products WHERE user_id = ? AND product_id = ?");
$stmt->execute([$user_id, $package['id']]);
$user_has_package = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$user_has_package) {
die("You do not have access to this package.");
}
// Generate HTML for the package page
$page_title = $package['name'];
$package_content = generatePackageContent($package['name']);
// Function to generate specific content based on package
function generatePackageContent($package_name) {
switch ($package_name) {
case 'Diamond Package':
return '
<div class="bg-gradient-to-br from-purple-500 to-pink-500 p-6 rounded-lg text-white">
<h2 class="text-2xl font-bold mb-4">πŸ’Ž Diamond Package Benefits</h2>
<ul class="list-disc list-inside space-y-2">
<li>Priority customer support</li>
<li>Exclusive investment opportunities</li>
<li>Higher cashback rates on all purchases</li>
<li>Access to premium products</li>
<li>Weekly market insights report</li>
</ul>
<div class="mt-6">
<h3 class="text-xl font-bold">Your Diamond Package Stats</h3>
<div class="grid grid-cols-2 gap-4 mt-4">
<div class="bg-white bg-opacity-20 p-4 rounded-lg">
<p class="text-sm">Total Earnings</p>
<p class="text-xl font-bold">KES 15,240.00</p>
</div>
<div class="bg-white bg-opacity-20 p-4 rounded-lg">
<p class="text-sm">Active Investments</p>
<p class="text-xl font-bold">3</p>
</div>
</div>
</div>
</div>
';
case 'Starlight Bundle':
return '
<div class="bg-gradient-to-br from-blue-500 to-teal-400 p-6 rounded-lg text-white">
<h2 class="text-2xl font-bold mb-4">✨ Starlight Bundle Benefits</h2>
<ul class="list-disc list-inside space-y-2">
<li>Standard customer support</li>
<li>Access to mid-range investment opportunities</li>
<li>Moderate cashback rates</li>
<li>Monthly market insights report</li>
</ul>
</div>
';
// Add more cases for other packages
default:
return '
<div class="bg-gray-800 p-6 rounded-lg text-white">
<h2 class="text-2xl font-bold mb-4">' . htmlspecialchars($package_name) . '</h2>
<p>Welcome to your package dashboard. Here you can monitor your investments and benefits.</p>
</div>
';
}
}
// Output the HTML page
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlspecialchars($page_title); ?> - Japanese Motors</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700;800&display=swap" rel="stylesheet">
<style>
:root {
--bg: #7b848d;
--card: #7a2f3b;
--card-2: #6f2630;
--accent: #efdf2d;
--muted: rgba(255,255,255,0.6);
--glass: rgba(255,255,255,0.04);
--promo-gradient: linear-gradient(180deg,#a13df0 0%, #ff2a79 50%, #d70b1a 100%);
font-family: 'Poppins', system-ui, Arial;
--banner-gradient-start: #a855f7;
--banner-gradient-end: #ec4899;
--spacing-unit: 1rem;
--accent-primary: #7c3aed;
--accent-secondary: #a855f7;
--shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.1);
--premium-gold: #d97706;
}
body {
background: var(--bg);
font-family: 'Poppins', sans-serif;
transition: all 0.3s ease;
min-height: 100vh;
}
.sidebar {
width: 250px;
height: 100vh;
background: #0d1321;
color: #fff;
position: fixed;
top: 0;
left: -250px;
transition: all 0.3s ease;
z-index: 1000;
overflow-y: auto;
}
.sidebar.active {
left: 0;
}
#content {
margin-left: 0;
transition: all 0.3s ease;
}
.sidebar.active ~ #content {
margin-left: 250px;
}
header {
background: #222;
color: white;
padding: 15px 20px;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
z-index: 900;
transition: all 0.3s ease;
}
.sidebar.active ~ #content header {
margin-left: 250px;
}
.menu-toggle {
background: transparent;
border: none;
color: white;
font-size: 1.5rem;
cursor: pointer;
}
.logo-section {
padding: 15px;
border-bottom: 1px solid #1c2230;
display: flex;
align-items: center;
gap: 10px;
}
.brand {
font-size: 1.2rem;
font-weight: 700;
color: #ff9800;
}
.subtitle {
font-size: 0.75rem;
color: #aaa;
}
.menu {
list-style: none;
padding: 0;
margin: 0;
}
.menu li a {
display: flex;
align-items: center;
padding: 12px 20px;
color: white;
text-decoration: none;
transition: background 0.3s;
}
.menu li a:hover {
background: #1c2230;
}
.menu li a i {
margin-right: 12px;
}
.user-footer {
padding: 15px;
background: #222;
display: flex;
align-items: center;
gap: 10px;
position: sticky;
bottom: 0;
}
.avatar {
width: 35px;
height: 35px;
background: #444;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
color: white;
}
.banner {
max-width: 450px;
margin: 0 auto calc(var(--spacing-unit) * 2);
background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
border-radius: 12px;
padding: calc(var(--spacing-unit) * 1.5);
text-align: center;
box-shadow: var(--shadow-hover);
animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
0% { opacity: 1; }
50% { opacity: 0.3; }
100% { opacity: 1; }
}
.banner .title {
font-size: 1.25rem;
margin-bottom: calc(var(--spacing-unit) * 1);
color: #ffffff;
font-weight: 700;
animation: blink 1.5s infinite;
}
.banner p {
font-size: 0.95rem;
line-height: 1.6;
margin-bottom: calc(var(--spacing-unit) * 1);
color: var(--premium-gold);
animation: blink 1.5s infinite;
}
.banner .footer {
font-size: 0.75rem;
color: rgba(255, 255, 255, 0.9);
font-style: italic;
animation: blink 1.5s infinite;
}
.promo .inner {
background: rgba(255,255,255,0.06);
padding: 14px;
border-radius: 10px;
margin: 6px 0;
}
.card {
background: var(--card);
border-radius: 12px;
padding: 26px;
color: white;
box-shadow: 0 6px 0 rgba(0,0,0,0.08) inset;
flex: 1;
}
.product-card {
background: rgba(255,255,255,0.05);
border-radius: 12px;
padding: 20px;
margin-bottom: 16px;
transition: all 0.3s ease;
}
.product-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
.product-badge {
position: absolute;
top: -8px;
right: -8px;
background: var(--accent);
color: #111;
padding: 4px 10px;
border-radius: 20px;
font-size: 12px;
font-weight: bold;
}
.btn {
display: inline-block;
padding: 14px 24px;
border-radius: 10px;
background: var(--accent);
color: #111;
font-weight: 700;
border: none;
cursor: pointer;
width: 100%;
}
.muted {
color: rgba(255,255,255,0.6);
}
@media (max-width: 768px) {
.promo {
width: 92%;
}
}
</style>
</head>
<body>
<!-- Sidebar -->
<aside class="sidebar" id="sidebar">
<div class="logo-section">
<i data-feather="zap" class="text-yellow-400"></i>
<div>
<h2 class="brand">JMOTORS</h2>
<p class="subtitle">Marketing Platform</p>
</div>
</div>
<ul class="menu">
<li><a href="index.php"><i data-feather="home"></i> Dashboard</a></li>
<li><a href="meta-uploads.php"><i data-feather="upload"></i> Meta Uploads</a></li>
<li><a href="transactions.php"><i data-feather="repeat"></i> Transactions</a></li>
<li><a href="transfer.php"><i data-feather="send"></i> Transfer</a></li>
<li><a href="daily-product.php"><i data-feather="shopping-bag"></i> Daily Product</a></li>
<li><a href="withdraw.php"><i data-feather="dollar-sign"></i> Withdraw</a></li>
<li><a href="packages.php"><i data-feather="package"></i> Packages</a></li>
<li><a href="loan.php"><i data-feather="credit-card"></i> Loan</a></li>
<li><a href="recharge.php"><i data-feather="battery-charging"></i> Recharge</a></li>
<li><a href="agent-approval.php" class="active-page"><i data-feather="user-check"></i> Agent Approval</a></li>
<li><a href="access-token.php"><i data-feather="key"></i> Access Token</a></li>
<li><a href="agent-claim.php"><i data-feather="tag"></i> Agent Claim</a></li>
<li><a href="team.php"><i data-feather="users"></i> Team</a></li>
</ul>
<ul class="menu bottom">
<li><a href="profile.php"><i data-feather="user"></i> Profile</a></li>
<li><a href="settings.php"><i data-feather="settings"></i> Settings</a></li>
<li><a href="whatsapp-channel.php"><i data-feather="message-square"></i> Whatsapp Channel</a></li>
<li><a href="customer-care.php"><i data-feather="headphones"></i> Customer Care</a></li>
</ul>
<div class="user-footer">
<div class="avatar"><?php echo substr($username, 0, 2); ?></div>
<div>
<h4><?php echo $username; ?></h4>
<p><?php echo $tier; ?> - Marketer</p>
</div>
</div>
</aside>
<!-- Main Content -->
<div id="content">
<header class="bg-gray-800 text-white p-4">
<div class="flex items-center">
<button class="menu-toggle" id="menu-toggle">
<i data-feather="menu"></i>
</button>
<div class="ml-4 font-bold text-xl">Jmotors</div>
</div>
<nav class="flex items-center space-x-6">
<a href="transfer.php" class="hover:text-yellow-300">Transfer</a>
<a href="loan.php" class="hover:text-yellow-300">Loans</a>
<a href="dailyproduct.php" class="hover:text-yellow-300">New Product</a>
<div class="w-9 h-9 rounded-full bg-gradient-to-r from-yellow-300 to-orange-400 flex items-center justify-center font-bold">MI</div>
</nav>
</header>
<main class="p-4">
<div class="max-w-4xl mx-auto">
<?php echo $package_content; ?>
<div class="mt-6 grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-gray-800 p-4 rounded-lg text-white">
<h3 class="text-lg font-bold mb-2">Package Actions</h3>
<button class="bg-yellow-400 text-black px-4 py-2 rounded-lg w-full mb-2 font-bold">
View Investment Portfolio
</button>
<button class="bg-green-500 text-white px-4 py-2 rounded-lg w-full mb-2">
Request Support
</button>
<button class="bg-blue-500 text-white px-4 py-2 rounded-lg w-full">
Upgrade Package
</button>
</div>
<div class="bg-gray-800 p-4 rounded-lg text-white">
<h3 class="text-lg font-bold mb-2">Performance Metrics</h3>
<div class="space-y-2">
<div>
<p class="text-sm text-gray-300">Return on Investment</p>
<div class="w-full bg-gray-700 rounded-full h-2.5">
<div class="bg-green-500 h-2.5 rounded-full" style="width: 75%"></div>
</div>
<p class="text-right text-sm mt-1">75%</p>
</div>
<div>
<p class="text-sm text-gray-300">Package Utilization</p>
<div class="w-full bg-gray-700 rounded-full h-2.5">
<div class="bg-yellow-400 h-2.5 rounded-full" style="width: 60%"></div>
</div>
<p class="text-right text-sm mt-1">60%</p>
</div>
</div>
</div>
</div>
</div>
</main>
</body>
</html>