Editing: /home/goacom/public_html/scratch_extract/deposit-record.php
<?php /* * DATABASE CONFIGURATION */ $host = 'localhost'; $db = 'tishanw1_melbets'; $user = 'tishanw1_melbets'; $pass = 'tishanw1_melbets'; $charset = 'utf8mb4'; // Simulating a logged-in user ID $current_user_id = 1; // --- HANDLE TAB PARAMETERS --- $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'today'; // Database Connection $mysqli = new mysqli($host, $user, $pass, $db); if ($mysqli->connect_error) { die("Connection failed: " . $mysqli->connect_error); } // --------------------------------------------------------- // LOGIC: DATE FILTERING // --------------------------------------------------------- $date_condition = ""; if ($active_tab == 'today') { $date_condition = "DATE(created_at) = CURDATE()"; } elseif ($active_tab == 'yesterday') { $date_condition = "DATE(created_at) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)"; } elseif ($active_tab == 'week') { $date_condition = "DATE(created_at) >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)"; } else { $date_condition = "DATE(created_at) = CURDATE()"; } // --------------------------------------------------------- // LOGIC: FETCH DATA FROM NEW TABLE // --------------------------------------------------------- $sql = "SELECT * FROM deposit_withdrawal_history WHERE user_id = ? AND $date_condition ORDER BY created_at DESC"; $stmt = $mysqli->prepare($sql); $stmt->bind_param("i", $current_user_id); $stmt->execute(); $result = $stmt->get_result(); ?> <!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 - Submission history" /> <title>MELBETE - Submission history</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" /> <style> body { margin: 0; padding: 0; font-family: 'Outfit', sans-serif; background-color: #f5f5f5; -webkit-tap-highlight-color: transparent; } /* Helper classes */ .border-cricxo { border-color: rgb(240, 104, 39); } .text-cricxo { color: rgb(240, 104, 39); } .text-gray-600 { color: rgb(75, 85, 99); } .text-gray-500 { color: rgb(107, 114, 128); } /* List Item Styling */ .history-item { background-color: white; padding: 16px; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; align-items: center; } .history-left { display: flex; flex-direction: column; gap: 2px; width: 100%; margin-right: 10px; } .history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; } .history-type { font-weight: 700; font-size: 15px; color: #333; text-transform: capitalize; } .history-meta { font-size: 12px; color: #6b7280; } .history-date { font-size: 11px; color: #9ca3af; margin-top: 2px; } /* Status Badges */ .badge { font-size: 10px; padding: 3px 8px; border-radius: 10px; text-transform: uppercase; font-weight: 700; display: inline-block; } .badge-approved { background-color: #d1fae5; color: #059669; } .badge-pending { background-color: #fef3c7; color: #d97706; } .badge-rejected { background-color: #fee2e2; color: #dc2626; } .badge-processing { background-color: #dbeafe; color: #2563eb; } .history-amount { font-weight: 800; font-size: 18px; white-space: nowrap; } .amount-pos { color: #10b981; } .amount-neg { color: #ef4444; } </style> </head> <body> <div id="root"> <div class="w-full bg-bodyColor"> <div class="max-w-[1000px] mx-auto"> <div class="flex flex-col h-screen"> <!-- Header --> <div class="flex justify-between items-center h-12" style="background: rgb(240, 104, 39);"> <svg onclick="history.back()" stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" class="text-white cursor-pointer text-[26px] w-16" 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> <div class="w-full text-white text-[19px] text-center">Submission history</div> </div> <div class="flex-1 overflow-y-auto py-4 bg-white"> <!-- Tabs --> <div class="flex px-2 items-center justify-between border-b pb-2 mb-4" style="border-bottom: 1px solid #e5e7eb;"> <button onclick="setTab('today')" class="flex-1 text-center pb-1 <?php echo ($active_tab == 'today') ? 'border-b-2 border-cricxo text-cricxo' : 'text-gray-600'; ?> font-medium">Today</button> <button onclick="setTab('yesterday')" class="flex-1 text-center pb-1 <?php echo ($active_tab == 'yesterday') ? 'border-b-2 border-cricxo text-cricxo' : 'text-gray-600'; ?>">Yesterday</button> <button onclick="setTab('week')" class="flex-1 text-center pb-1 <?php echo ($active_tab == 'week') ? 'border-b-2 border-cricxo text-cricxo' : 'text-gray-600'; ?>">7 days</button> </div> <!-- List Area --> <?php if ($result->num_rows > 0): ?> <?php while($row = $result->fetch_assoc()): $type = $row['type']; $status = $row['status']; $method = $row['payment_method']; $amount = number_format($row['amount'], 2); $date = date('Y-m-d H:i:s', strtotime($row['created_at'])); $txHash = $row['transaction_hash']; // Logic for Badge Class if($status == 'approved') $badgeClass = 'badge-approved'; elseif($status == 'rejected') $badgeClass = 'badge-rejected'; elseif($status == 'processing') $badgeClass = 'badge-processing'; else $badgeClass = 'badge-pending'; // Logic for Amount Color $amountClass = ($type == 'withdrawal') ? 'amount-neg' : 'amount-pos'; $prefix = ($type == 'withdrawal') ? '-' : '+'; ?> <div class="history-item"> <div class="history-left"> <div class="history-header"> <span class="history-type"><?php echo $type; ?></span> <span class="badge <?php echo $badgeClass; ?>"><?php echo $status; ?></span> </div> <div class="history-meta">Method: <?php echo htmlspecialchars($method); ?></div> <?php if($txHash): ?> <div class="history-meta" style="font-size:10px; color:#aaa;">TX: <?php echo substr($txHash, 0, 10) . '...'; ?></div> <?php endif; ?> <div class="history-date"><?php echo $date; ?></div> </div> <div class="history-amount <?php echo $amountClass; ?>"> <?php echo $prefix . $amount; ?> </div> </div> <?php endwhile; ?> <?php else: ?> <p style="text-align: center;" class="text-gray-500" style="margin-top: 50px;">No records found.</p> <?php endif; ?> </div> </div> </div> </div> </div> <script> function setTab(tabName) { window.location.href = '?tab=' + tabName; } </script> </body> </html>
💾 Save