Editing: /home/goacom/public_html/scratch_extract/vip.php
<?php /* * 1. START SESSION & CHECK LOGIN */ session_start(); // If not logged in, redirect if (!isset($_SESSION['user_id'])) { header("Location: login.php"); exit(); } // Database Config $host = 'localhost'; $db = 'tishanw1_melbets'; $user = 'tishanw1_melbets'; $pass = 'tishanw1_melbets'; $user_id = $_SESSION['user_id']; // Connect $conn = new mysqli($host, $user, $pass, $db); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // --- FETCH DATA & STATS --- // 1. Total Deposit (Approved) $stmt_dep = $conn->prepare("SELECT COALESCE(SUM(amount), 0) as total_deposit FROM deposit_withdrawal_history WHERE user_id = ? AND type = 'deposit' AND status = 'approved'"); $stmt_dep->bind_param("i", $user_id); $stmt_dep->execute(); $dep_data = $stmt_dep->get_result()->fetch_assoc(); $total_deposit = $dep_data['total_deposit']; // 2. Total Bet $stmt_bet = $conn->prepare("SELECT COALESCE(SUM(amount), 0) as total_bet FROM transactions WHERE user_id = ? AND type = 'bet'"); $stmt_bet->bind_param("i", $user_id); $stmt_bet->execute(); $bet_data = $stmt_bet->get_result()->fetch_assoc(); $total_bet = $bet_data['total_bet']; // 3. Determine VIP Level $vip_level = 0; if ($total_deposit >= 50000) { $vip_level = 2; } elseif ($total_deposit >= 10000) { $vip_level = 1; } // 4. Determine Next Level Requirements $next_level_dep = 0; $next_level_text = "Max Level Reached"; if ($vip_level == 0) { $next_level_dep = 10000; $next_level_text = "Deposit 10,000 to reach VIP 1"; } elseif ($vip_level == 1) { $next_level_dep = 50000; $next_level_text = "Deposit 50,000 to reach VIP 2"; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="description" content="MELBETE - Official Gaming & Betting Platform." /> <title>MELBETE - VIP</title> <link rel="stylesheet" href="index.css" /> <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&display=swap" rel="stylesheet" /> <!-- Swiper CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" /> <!-- Swiper JS (Required for slider to work) --> <script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script> </head> <body> <div id="root"> <div class="w-full bg-bodyColor"> <div class="max-w-[1000px] mx-auto"> <!-- Header --> <div class="bg-black w-full"> <div class="flex justify-between items-center h-12" style="background: rgb(240, 104, 39);"> <a href="reward-center.php" class="text-white cursor-pointer text-[26px] w-16 flex items-center justify-center"> <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M217.9 256L345 129c9.4-9.4 9.4-24.6 0-33.9-9.4-9.4-24.6-9.3-34 0L167 239c-9.1 9.1-9.3 23.7-.7 33.1L310.9 417c4.7 4.7 10.9 7 17 7s12.3-2.3 17-7c9.4-9.4 9.4-24.6 0-33.9L217.9 256z"></path></svg> </a> <div class="w-full text-white text-[19px] text-center"> VIP Benefits </div> </div> </div> <div class="w-full p-[14px] bg-[#f5f5f9] min-h-screen"> <!-- Current VIP Card --> <div class="rounded px-2 mt-3" style="background: linear-gradient(0deg, rgb(241, 249, 255), rgb(179, 188, 200));"> <div class="member-level-info min-h-[57px] flex items-center justify-between"> <div class="flex items-center relative z-[1] flex-1"> <!-- Dynamic VIP Badge Image based on level --> <?php // Using generic icon or different colors/styles if images aren't available per level // For now, reusing the provided image path ?> <img class="h-[65px]" src="./assets/img/lv9.be016011.png" alt="VIP Badge"> <div class="font-bold text-[#333] text-[21px]"> VIP <?php echo $vip_level; ?> </div> </div> <!-- Upgrade Button --> <?php if($vip_level < 2): ?> <a href="deposit.php" class="shadow-[-0.03rem_04px_010px_0_rgba(0,0,0,0.1)] backdrop-blur-[1px] w-[115px] min-h-[33px] flex items-center justify-center gap-[0.1rem] text-[#434851] text-[10px] font-semibold leading-none pl-[0.24rem] pr-[0.15rem] py-[0.1rem] rounded-[33px_0_0_33px] text-decoration-none"> Upgrade </a> <?php else: ?> <div class="w-[115px] min-h-[33px] flex items-center justify-center text-[#999] text-[10px] font-bold bg-gray-200 rounded-[33px_0_0_33px]"> Max Level </div> <?php endif; ?> </div> <!-- Requirements Text --> <div class="border-l-4 mt-5 mb-3 border-[#fd2f2f] text-sm pl-[19px] text-[#666]"> Level Up Requirements </div> <p class="text-[#666] text-[10px] pb-3"> <?php echo $next_level_text; ?> </p> </div> <!-- Stats & Swiper Container --> <div class="w-full relative pl-[150px] rounded-[9px] bg-white mt-3" style="box-shadow: rgba(255, 236, 170, 0.3) 0px 0px 0.4rem 0px;"> <!-- Left Stats Sidebar --> <div class="flex flex-col absolute w-[33%] text-[#666] text-[11px] font-semibold z-10 left-0 top-[38px]" style="background: linear-gradient(rgba(241, 249, 255, 0.15), rgba(179, 188, 200, 0.15));"> <div class="h-[93px] flex flex-col px-[3px] py-[10px] border-b-[0.02rem] border-b-[hsla(240,7%,94%,0.5)] border-solid"> <div class="text-[11px] font-bold">Total deposit</div> <div class="text-[13px] mt-1">৳ <?php echo number_format($total_deposit, 2); ?></div> </div> <div class="h-[93px] flex flex-col px-[3px] py-[10px] border-b-[0.02rem] border-b-[hsla(240,7%,94%,0.5)] border-solid"> <div class="text-[11px] font-bold">Total bet</div> <div class="text-[13px] mt-1">৳ <?php echo number_format($total_bet, 2); ?></div> </div> </div> <!-- Swiper for VIP Tiers --> <div class="swiper mySwiper"> <div class="swiper-wrapper"> <!-- Slide 1: VIP 1 --> <div class="swiper-slide p-4 pt-[40px]"> <div class="bg-orange-50 border border-orange-200 rounded-lg p-4 text-center"> <h3 class="font-bold text-orange-600 text-lg">VIP 1</h3> <p class="text-xs text-gray-500 mt-2">Requirements: 10,000 Deposit</p> <p class="text-sm mt-2">✅ 1999 BDT Bonus</p> <p class="text-sm">✅ 5% Rescue Fund</p> </div> </div> <!-- Slide 2: VIP 2 --> <div class="swiper-slide p-4 pt-[40px]"> <div class="bg-blue-50 border border-blue-200 rounded-lg p-4 text-center"> <h3 class="font-bold text-blue-600 text-lg">VIP 2</h3> <p class="text-xs text-gray-500 mt-2">Requirements: 50,000 Deposit</p> <p class="text-sm mt-2">✅ 3999 BDT Bonus</p> <p class="text-sm">✅ 10% Rescue Fund</p> </div> </div> <!-- Slide 3: VIP 3 (Hypothetical) --> <div class="swiper-slide p-4 pt-[40px]"> <div class="bg-purple-50 border border-purple-200 rounded-lg p-4 text-center"> <h3 class="font-bold text-purple-600 text-lg">VIP 3</h3> <p class="text-xs text-gray-500 mt-2">Requirements: 100,000 Deposit</p> <p class="text-sm mt-2">✅ Higher Bonuses</p> <p class="text-sm">✅ Exclusive Support</p> </div> </div> </div> <!-- Swiper Pagination (Optional) --> <div class="swiper-pagination"></div> </div> </div> </div> </div> </div> </div> <section class="Toastify" aria-live="polite" aria-atomic="false" aria-relevant="additions text" aria-label="Notifications Alt+T"></section> <!-- Swiper Initialization Script --> <script> var swiper = new Swiper(".mySwiper", { spaceBetween: 10, slidesPerView: 1.1, centeredSlides: true, pagination: { el: ".swiper-pagination", clickable: true, }, }); </script> </body> </html> <?php $conn->close(); ?>
💾 Save