Linux spg1.cloudpowerdns.com 5.14.0-611.34.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 18 05:51:10 EST 2026 x86_64
LiteSpeed
Server IP : 176.9.63.151 & Your IP : 216.73.217.60
Domains :
Cant Read [ /etc/named.conf ]
User : fastear1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
fastear1 /
.trash /
admin /
Delete
Unzip
Name
Size
Permission
Date
Action
ads.php
13.96
KB
-rw-r--r--
2025-10-17 23:08
auth.php
343
B
-rw-r--r--
2025-10-17 23:20
dashboard.php
8.71
KB
-rw-r--r--
2025-10-18 00:40
deposit_methods.php
12.36
KB
-rw-r--r--
2025-10-17 23:06
deposits.php
13.24
KB
-rw-r--r--
2025-10-18 00:56
dpin.php
6.16
KB
-rw-r--r--
2025-10-17 23:06
footer.php
565
B
-rw-r--r--
2025-10-17 23:05
header.php
13.05
KB
-rw-r--r--
2025-10-18 00:59
login.php
3.37
KB
-rw-r--r--
2025-10-17 23:09
login_as_user.php
1020
B
-rw-r--r--
2025-10-17 23:05
logout.php
88
B
-rw-r--r--
2025-10-17 23:08
plans.php
13.65
KB
-rw-r--r--
2025-10-17 23:06
referral_commissions.php
11.93
KB
-rw-r--r--
2025-10-18 00:13
team_commissions.php
6.66
KB
-rw-r--r--
2025-10-17 23:45
test_modals.php
4.44
KB
-rw-r--r--
2025-10-18 00:49
test_referral_commissions.php
2.87
KB
-rw-r--r--
2025-10-18 00:13
test_user_edit.php
4.96
KB
-rw-r--r--
2025-10-18 00:44
transactions.php
6.36
KB
-rw-r--r--
2025-10-17 23:08
users.php
13.55
KB
-rw-r--r--
2025-10-18 00:49
withdraw_methods.php
12.49
KB
-rw-r--r--
2025-10-17 23:08
withdraws.php
9.16
KB
-rw-r--r--
2025-10-17 23:39
Save
Rename
<?php $title = 'Manage Deposits'; include 'header.php'; // Function to calculate and distribute referral commissions function calculateReferralCommissions($pdo, $user_id, $amount, $transaction_id = null) { try { // If transaction_id is provided, check if commissions have already been calculated for this transaction if ($transaction_id) { $stmt = $pdo->prepare("SELECT COUNT(*) as count FROM referrals WHERE source_transaction_id = ?"); $stmt->execute([$transaction_id]); if ($stmt->fetch()['count'] > 0) { // Commissions already calculated for this transaction return; } } // Get referral commission levels $stmt = $pdo->prepare("SELECT * FROM referral_commissions ORDER BY level ASC"); $stmt->execute(); $commission_levels = $stmt->fetchAll(); // Get user's referrer $stmt = $pdo->prepare("SELECT referred_by FROM users WHERE id = ?"); $stmt->execute([$user_id]); $user = $stmt->fetch(); if (!$user || !$user['referred_by']) { return; // No referrer } // Calculate commissions for each level foreach ($commission_levels as $level_data) { $level = $level_data['level']; $percentage = $level_data['commission_percentage']; // Get the referrer at this level $referrer = getReferrerAtLevel($pdo, $user_id, $level); if ($referrer) { $commission_amount = ($amount * $percentage) / 100; // Add commission to referrer's balance $stmt = $pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?"); $stmt->execute([$commission_amount, $referrer['id']]); // Add transaction record $stmt = $pdo->prepare("INSERT INTO transactions (user_id, type, amount, note) VALUES (?, 'commission', ?, ?)"); $stmt->execute([$referrer['id'], $commission_amount, 'Referral commission (Level ' . $level . '): ' . $percentage . '% of ₨' . number_format($amount, 2)]); // Get the transaction ID of the newly inserted commission transaction $commission_transaction_id = $pdo->lastInsertId(); // Add referral record if ($transaction_id) { // If we have a transaction ID, include it in the referral record $stmt = $pdo->prepare("INSERT INTO referrals (user_id, referred_user_id, level, commission_amount, transaction_id, source_transaction_id) VALUES (?, ?, ?, ?, ?, ?)"); $stmt->execute([$referrer['id'], $user_id, $level, $commission_amount, $commission_transaction_id, $transaction_id]); } else { // If we don't have a transaction ID, insert without it $stmt = $pdo->prepare("INSERT INTO referrals (user_id, referred_user_id, level, commission_amount, transaction_id) VALUES (?, ?, ?, ?, ?)"); $stmt->execute([$referrer['id'], $user_id, $level, $commission_amount, $commission_transaction_id]); } } } } catch (PDOException $e) { // Log error but don't stop the process error_log('Referral commission calculation failed: ' . $e->getMessage()); } } // Function to get referrer at a specific level function getReferrerAtLevel($pdo, $user_id, $level) { try { $current_user_id = $user_id; // Traverse up the referral chain for ($i = 1; $i <= $level; $i++) { $stmt = $pdo->prepare("SELECT referred_by FROM users WHERE id = ?"); $stmt->execute([$current_user_id]); $user = $stmt->fetch(); if (!$user || !$user['referred_by']) { return null; // No referrer at this level } $current_user_id = $user['referred_by']; } // Get the referrer details $stmt = $pdo->prepare("SELECT id FROM users WHERE id = ?"); $stmt->execute([$current_user_id]); return $stmt->fetch(); } catch (PDOException $e) { return null; } } $error = ''; $success = ''; // Handle deposit approval/rejection if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) { $deposit_id = intval($_POST['deposit_id']); $action = $_POST['action']; try { if ($action === 'approve') { // Approve deposit $stmt = $pdo->prepare("UPDATE deposits SET status = 'approved' WHERE id = ?"); $stmt->execute([$deposit_id]); // Get deposit details $stmt = $pdo->prepare("SELECT * FROM deposits WHERE id = ?"); $stmt->execute([$deposit_id]); $deposit = $stmt->fetch(); if ($deposit) { // Add amount to user balance $stmt = $pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?"); $stmt->execute([$deposit['amount'], $deposit['user_id']]); // Add transaction record $stmt = $pdo->prepare("INSERT INTO transactions (user_id, type, amount, note) VALUES (?, 'deposit', ?, 'Deposit approved')"); $stmt->execute([$deposit['user_id'], $deposit['amount']]); // Get the transaction ID of the newly inserted transaction $transaction_id = $pdo->lastInsertId(); // Calculate and distribute referral commissions calculateReferralCommissions($pdo, $deposit['user_id'], $deposit['amount'], $transaction_id); $success = 'Deposit approved successfully.'; } } elseif ($action === 'reject') { // Reject deposit $stmt = $pdo->prepare("UPDATE deposits SET status = 'rejected' WHERE id = ?"); $stmt->execute([$deposit_id]); $success = 'Deposit rejected successfully.'; } } catch (PDOException $e) { $error = 'Failed to update deposit status. Please try again.'; } } // Get all pending deposits try { $stmt = $pdo->prepare("SELECT d.*, u.fullname, u.email FROM deposits d JOIN users u ON d.user_id = u.id WHERE d.status = 'pending' ORDER BY d.created_at DESC"); $stmt->execute(); $pending_deposits = $stmt->fetchAll(); } catch (PDOException $e) { $pending_deposits = []; $error = 'Failed to fetch pending deposits.'; } // Get recent deposits (approved/rejected) try { $stmt = $pdo->prepare("SELECT d.*, u.fullname, u.email FROM deposits d JOIN users u ON d.user_id = u.id WHERE d.status IN ('approved', 'rejected') ORDER BY d.created_at DESC LIMIT 20"); $stmt->execute(); $recent_deposits = $stmt->fetchAll(); } catch (PDOException $e) { $recent_deposits = []; } ?> <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom"> <h1 class="h2">Manage Deposits</h1> </div> <?php if ($error): ?> <div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div> <?php endif; ?> <?php if ($success): ?> <div class="alert alert-success"><?php echo htmlspecialchars($success); ?></div> <?php endif; ?> <!-- Pending Deposits --> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <h5 class="card-title">Pending Deposits</h5> <?php if (count($pending_deposits) > 0): ?> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>User</th> <th>Amount</th> <th>Method</th> <th>Date</th> <th>Receipt</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($pending_deposits as $deposit): ?> <tr> <td><?php echo $deposit['id']; ?></td> <td><?php echo htmlspecialchars($deposit['fullname'] . ' (' . $deposit['email'] . ')'); ?></td> <td>₨<?php echo number_format($deposit['amount'], 2); ?></td> <td><?php echo htmlspecialchars($deposit['method']); ?></td> <td><?php echo date('M d, Y H:i', strtotime($deposit['created_at'])); ?></td> <td> <?php if ($deposit['receipt']): ?> <a href="../<?php echo htmlspecialchars($deposit['receipt']); ?>" target="_blank" class="btn btn-sm btn-outline-primary">View</a> <?php else: ?> - <?php endif; ?> </td> <td> <form method="POST" class="d-inline"> <input type="hidden" name="deposit_id" value="<?php echo $deposit['id']; ?>"> <button type="submit" name="action" value="approve" class="btn btn-sm btn-success">Approve</button> </form> <form method="POST" class="d-inline"> <input type="hidden" name="deposit_id" value="<?php echo $deposit['id']; ?>"> <button type="submit" name="action" value="reject" class="btn btn-sm btn-danger">Reject</button> </form> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <?php else: ?> <p>No pending deposits found.</p> <?php endif; ?> </div> </div> </div> </div> <!-- Recent Deposits --> <div class="row mt-4"> <div class="col-12"> <div class="card"> <div class="card-body"> <h5 class="card-title">Recent Deposits</h5> <?php if (count($recent_deposits) > 0): ?> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>User</th> <th>Amount</th> <th>Method</th> <th>Date</th> <th>Status</th> </tr> </thead> <tbody> <?php foreach ($recent_deposits as $deposit): ?> <tr> <td><?php echo $deposit['id']; ?></td> <td><?php echo htmlspecialchars($deposit['fullname'] . ' (' . $deposit['email'] . ')'); ?></td> <td>₨<?php echo number_format($deposit['amount'], 2); ?></td> <td><?php echo htmlspecialchars($deposit['method']); ?></td> <td><?php echo date('M d, Y H:i', strtotime($deposit['created_at'])); ?></td> <td> <?php if ($deposit['status'] === 'approved'): ?> <span class="badge bg-success">Approved</span> <?php else: ?> <span class="badge bg-danger">Rejected</span> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <?php else: ?> <p>No recent deposits found.</p> <?php endif; ?> </div> </div> </div> </div> <?php include 'footer.php'; ?>