PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
require_once('includes/connect.php');
require_once('includes/functions.php');
session_start();
if(isset($_GET["l"])){
admlogout();
header("location: logout.php");
exit();
}
if(!isset($_SESSION['pass'])) {
header("location: login.php");
exit();
}
$alertMessage = "";
$alertType = "";
// =========================================================
// HANDLE APPROVE / REJECT ACTIONS
// =========================================================
if (isset($_GET['action']) && isset($_GET['id'])) {
$id = intval($_GET['id']);
$action = $_GET['action'];
// Check if the transaction exists and is pending
$checkQuery = $conn->query("SELECT * FROM transactions WHERE id = $id AND type = 'DEPOSIT' AND status = 'PENDING' LIMIT 1");
if ($checkQuery && $checkQuery->num_rows > 0) {
$depositData = $checkQuery->fetch_assoc();
$amount = floatval($depositData['amount']);
$userId = intval($depositData['user_id']);
if ($action === 'approve') {
// 1. Update Transaction Status
$updateTx = $conn->query("UPDATE transactions SET status = 'COMPLETED' WHERE id = $id");
// 2. Add funds to User's Capital
if ($updateTx) {
$updateUser = $conn->query("UPDATE members SET Capital = Capital + $amount WHERE ID = $userId");
if ($updateUser) {
$alertMessage = "Deposit of $" . number_format($amount, 2) . " approved and credited to user's Capital.";
$alertType = "success";
} else {
$alertMessage = "Transaction approved, but failed to credit user capital.";
$alertType = "error";
}
}
} elseif ($action === 'reject') {
// Reject Transaction
$updateTx = $conn->query("UPDATE transactions SET status = 'REJECTED' WHERE id = $id");
if ($updateTx) {
$alertMessage = "Deposit request has been rejected.";
$alertType = "success";
}
}
} else {
$alertMessage = "Transaction not found or already processed.";
$alertType = "error";
}
}
// =========================================================
// FETCH ALL DEPOSITS
// =========================================================
$depositsQuery = $conn->query("
SELECT t.*, m.Email, m.Uname
FROM transactions t
LEFT JOIN members m ON t.user_id = m.ID
WHERE t.type = 'DEPOSIT'
ORDER BY t.created_at DESC
");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Melody Admin - Manage Deposits</title>
<link rel="stylesheet" href="vendors/iconfonts/font-awesome/css/all.min.css">
<link rel="stylesheet" href="vendors/css/vendor.bundle.base.css">
<link rel="stylesheet" href="vendors/css/vendor.bundle.addons.css">
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="images/favicon.html" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
/* ========================================= */
/* MOBILE SIDEBAR MENU CSS */
/* ========================================= */
@media (max-width: 768px) {
.sidebar { transition: left 0.3s ease; }
.sidebar.open { left: 0 !important; }
}
/* ========================================= */
/* ADMIN DASHBOARD SPECIFIC CSS */
/* ========================================= */
.admin-section-card { background: #1a1d21; border: 1px solid #333; border-radius: 12px; padding: 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px;}
.section-title { font-size: 1.25rem; font-weight: 600; color: #fff; margin: 0; }
/* Search Bar */
.admin-search-wrapper { position: relative; width: 100%; max-width: 350px; }
.admin-search-wrapper svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #8a8d97; }
.admin-search-wrapper input { background-color: #2c2f36; border: 1px solid #444; border-radius: 8px; color: #fff; padding: 10px 10px 10px 40px; width: 100%; font-size: 14px; outline: none;}
.admin-search-wrapper input:focus { border-color: #31acee; }
/* Admin Table Styles */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 1000px; }
.admin-table th, .admin-table td { padding: 14px 12px; text-align: left; color: #e0e0e0; border-bottom: 1px solid #2d3038; font-size: 14px; }
.admin-table th { color: #8a8d97; font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px; }
.admin-table tbody tr { transition: background-color 0.2s; }
.admin-table tbody tr:hover { background-color: hsla(0, 0%, 100%, 0.02); }
/* Badges & Action Buttons */
.badge { padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 12px; text-decoration: none; display: inline-block; text-align: center; transition: opacity 0.2s;}
.badge:hover { opacity: 0.8; color: #fff; }
.badge-info { background-color: rgba(49, 172, 238, 0.2); color: #31acee; border: 1px solid #31acee; }
.badge-success { background-color: rgba(38, 166, 154, 0.2); color: #26A69A; border: 1px solid #26A69A; }
.badge-danger { background-color: rgba(239, 83, 80, 0.2); color: #EF5350; border: 1px solid #EF5350; }
.badge-warning { background-color: rgba(255, 193, 7, 0.2); color: #ffc107; border: 1px solid #ffc107; }
/* Alerts */
.alert-msg { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.95em; text-align: center; font-weight: 500;}
.alert-error { background-color: rgba(244, 67, 54, 0.1); color: #EF5350; border: 1px solid rgba(244, 67, 54, 0.5);}
.alert-success { background-color: rgba(38, 166, 154, 0.1); color: #26A69A; border: 1px solid rgba(38, 166, 154, 0.5);}
@media (max-width: 768px) {
.admin-table thead { display: none; }
.admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; min-width: auto; }
.admin-table tr { background-color: #121417; border: 1px solid #2d3038; border-radius: 10px; margin-bottom: 16px; padding: 16px; }
.admin-table td { padding: 8px 0; text-align: right; position: relative; border: none; white-space: normal; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid hsla(0,0%,100%,0.05);}
.admin-table td:last-child { border-bottom: none; padding-bottom: 0; }
.admin-table td::before { content: attr(data-label); color: #8a8d97; font-size: 0.85rem; text-transform: uppercase; font-weight: 600; }
}
</style>
</head>
<body>
<div class="container-scroller dashboard-page">
<nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row default-layout-navbar">
<div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
<a class="navbar-brand brand-logo" href="index.php"><img src="images/logo-mini.svg" alt="logo"/></a>
<a class="navbar-brand brand-logo-mini" href="index.php"><img src="images/logo-mini.svg" alt="logo"/></a>
</div>
<div class="navbar-menu-wrapper d-flex align-items-stretch">
<button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
<span class="fas fa-bars"></span>
</button>
<ul class="navbar-nav navbar-nav-right">
<li class="nav-item nav-profile dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" id="profileDropdown">
<img src="images/faces/face5.jpg" alt="profile"/>
</a>
<div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="profileDropdown">
<a href="cp.php" class="dropdown-item">
<i class="fas fa-cog text-primary"></i>
Settings
</a>
<div class="dropdown-divider"></div>
<a href="index.php?l" class="dropdown-item">
<i class="fas fa-power-off text-primary"></i>
Logout
</a>
</div>
</li>
</ul>
<button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" id="mobile-menu-btn">
<span class="fas fa-bars"></span>
</button>
</div>
</nav>
<div class="container-fluid page-body-wrapper">
<nav class="sidebar sidebar-offcanvas" id="sidebar">
<ul class="nav">
<li class="nav-item nav-profile">
<div class="nav-link">
<div class="profile-image">
<img src="images/faces/face5.jpg" alt="image"/>
</div>
<div class="profile-name">
<p class="name">Welcome Jane</p>
<p class="designation">Super Admin</p>
</div>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php">
<i class="fa fa-home menu-icon"></i>
<span class="menu-title"><b>Admin Dashboard</b></span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#page-layouts" aria-expanded="false" aria-controls="page-layouts">
<i class="fab fa-trello menu-icon"></i>
<span class="menu-title">Member</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="page-layouts">
<ul class="nav flex-column sub-menu">
<li class="nav-item"> <a class="nav-link" href="topup.php">Top up</a></li>
</ul>
</div>
</li>
<li class="nav-item active">
<a class="nav-link" data-toggle="collapse" href="#sidebar-layouts" aria-expanded="true" aria-controls="sidebar-layouts">
<i class="fas fa-columns menu-icon"></i>
<span class="menu-title">Transaction</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse show" id="sidebar-layouts">
<ul class="nav flex-column sub-menu">
<li class="nav-item"> <a class="nav-link" href="transaction.php">View Transaction</a></li>
<li class="nav-item"> <a class="nav-link" href="withdrawal.php">Withdrawal</a></li>
<li class="nav-item"> <a class="nav-link active" href="admin_deposits.php">View Deposits</a></li>
<li class="nav-item"> <a class="nav-link" href="trash.php">Trash</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="admin_trades.php">
<i class="fas fa-chart-line menu-icon"></i>
<span class="menu-title">Set Trades</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="admin_realestate.php">
<i class="fas fa-building menu-icon"></i>
<span class="menu-title">Real Estate</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="acc.php">
<i class="fa fa-user menu-icon"></i>
<span class="menu-title">Account</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="notification.php">
<i class="fa fa-envelope menu-icon"></i>
<span class="menu-title">Send Notification</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="qmail.php">
<i class="fa fa-envelope menu-icon"></i>
<span class="menu-title">Send Email</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#ui-basic" aria-expanded="false" aria-controls="ui-basic">
<i class="far fa-compass menu-icon"></i>
<span class="menu-title">Settings</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="ui-basic">
<ul class="nav flex-column sub-menu">
<li class="nav-item"> <a class="nav-link" href="cp.php">Change password</a></li>
<li class="nav-item"> <a class="nav-link" href="script.php">Live chat Script</a></li>
<li class="nav-item"> <a class="nav-link" href="eth.php">Ethereum Address</a></li>
<li class="nav-item"> <a class="nav-link" href="usdt.php">Usdt-Trc20 Address</a></li>
<li class="nav-item"> <a class="nav-link" href="btc.php">Bitcoin Address</a></li>
</ul>
</div>
</li>
</ul>
</nav>
<div class="main-panel">
<div class="content-wrapper">
<?php if(!empty($alertMessage)): ?>
<div class="alert-msg <?php echo $alertType === 'success' ? 'alert-success' : 'alert-error'; ?>">
<?php echo $alertMessage; ?>
</div>
<?php endif; ?>
<section class="admin-section-card">
<div class="section-header">
<h3 class="section-title">Manage User Deposits</h3>
<div class="admin-search-wrapper">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
<input type="text" id="live-search-input" placeholder="Search by email, username, or amount...">
</div>
</div>
<div class="table-responsive">
<table class="admin-table">
<thead>
<tr>
<th>Date</th>
<th>User Info</th>
<th>Amount</th>
<th>Method</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php if($depositsQuery && $depositsQuery->num_rows > 0): ?>
<?php while($row = $depositsQuery->fetch_assoc()): ?>
<tr class="deposit-row">
<td data-label="Date"><?php echo date('M d, Y H:i', strtotime($row['created_at'])); ?></td>
<td data-label="User Info" class="searchable-info">
<div style="font-weight:bold; color:#fff;"><?php echo htmlspecialchars($row['Email'] ?? 'Unknown'); ?></div>
<div style="color:#8a8d97; font-size:12px;">User: <?php echo htmlspecialchars($row['Uname'] ?? 'Unknown'); ?></div>
</td>
<td data-label="Amount" class="searchable-amount" style="color:#26A69A; font-weight:bold;">
$<?php echo number_format($row['amount'], 2); ?>
</td>
<td data-label="Method"><?php echo htmlspecialchars($row['method'] ?? 'Crypto'); ?></td>
<td data-label="Status">
<?php
$status = strtoupper($row['status']);
if($status == 'COMPLETED') echo '<span class="badge badge-success">COMPLETED</span>';
elseif($status == 'REJECTED') echo '<span class="badge badge-danger">REJECTED</span>';
else echo '<span class="badge badge-warning">PENDING</span>';
?>
</td>
<td data-label="Actions">
<?php if($status == 'PENDING'): ?>
<a href="admin_deposits.php?action=approve&id=<?php echo $row['id']; ?>" class="badge badge-success" onclick="return confirm('Approve this deposit? The amount will be added to the users Capital balance.');" style="margin-right: 5px;">Approve</a>
<a href="admin_deposits.php?action=reject&id=<?php echo $row['id']; ?>" class="badge badge-danger" onclick="return confirm('Are you sure you want to reject this deposit?');">Reject</a>
<?php else: ?>
<span style="color:#8a8d97; font-size:12px;">Processed</span>
<?php endif; ?>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="6" style="text-align:center; padding: 30px; color:#8a8d97;">No deposits found in the database.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</section>
</div>
<footer class="footer">
<div class="d-sm-flex justify-content-center justify-content-sm-between">
<span class="text-muted text-center text-sm-left d-block d-sm-inline-block">Copyright © <?php echo date('Y'); ?>. All rights reserved.</span>
</div>
</footer>
</div>
</div>
</div>
<script src="vendors/js/vendor.bundle.base.js"></script>
<script src="vendors/js/vendor.bundle.addons.js"></script>
<script src="js/off-canvas.js"></script>
<script src="js/hoverable-collapse.js"></script>
<script src="js/misc.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Mobile Sidebar Toggle Fix
const mobileMenuBtn = document.getElementById('mobile-menu-btn');
const sidebar = document.getElementById('sidebar');
if (mobileMenuBtn && sidebar) {
mobileMenuBtn.addEventListener('click', function() {
sidebar.classList.toggle('open');
});
}
// Live Search Logic
const searchInput = document.getElementById('live-search-input');
const depositRows = document.querySelectorAll('.deposit-row');
if (searchInput) {
searchInput.addEventListener('input', function(e) {
const searchTerm = e.target.value.toLowerCase().trim();
depositRows.forEach(row => {
const infoText = row.querySelector('.searchable-info').textContent.toLowerCase();
const amountText = row.querySelector('.searchable-amount').textContent.toLowerCase();
if (infoText.includes(searchTerm) || amountText.includes(searchTerm)) {
row.style.display = '';
} else {
row.style.display = 'none';
}
});
});
}
});
</script>
</body>
</html>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E