PHP WebShell

Текущая директория: /var/www/bitcardoApp/backyard/user/wallets

Просмотр файла: platform-wallets.php

<? include '../common/header.php'; ?>
<style>
    .nk-wgw-name h6 {
    text-align: right;
}
</style>
    <div class="nk-content nk-content-fluid mt-5">
        <div class="container-xl wide-lg">
            <div class="nk-content-body">
            <div class="nk-block-head">
                <div class="nk-block-between-md g-4">
                    <div class="nk-block-head-content">
                        <h2 class="nk-block-title fw-normal">Platform Wallets</h2>
                        <div class="nk-block-des">
                            <p>At a glance of all main wallets on this platform!</p>
                        </div>
                    </div>
                    <div class="nk-block-head-content">
                        <ul class="nk-block-tools gx-3">
                            <li>
                                <a href="#" class="btn btn-danger"><span>Freeze Crypto Wallet</span></a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="nk-block">
                <div class="row gy-gs">
                    <div class="">
                        <div class="nk-block">
                        <div class="nk-block-head-xs">
                            <div class="nk-block-between-md g-2">
                                <div class="nk-block-head-content">
                                    <h5 class="nk-block-title title">Platform Wallets</h5>
                                </div>
                                
                            </div>
                        </div>
                        <div class="row g-2">
                        <?php
include_once '../../config/db_config.php';

// Fetch all central wallets (active and inactive)
$cwallet_query = "SELECT * FROM cwallet";
$cwallet_result = mysqli_query($conn, $cwallet_query);

while ($wallet = mysqli_fetch_assoc($cwallet_result)) {
    $coin = $wallet['coin'];
    $icon = $wallet['icon'];
    $status = $wallet['status'];
    $platform_balance = floatval($wallet['wallet_balance']);

    // Fetch total user balance for this coin
    $user_sum_query = "SELECT SUM(balance) AS total_user_balance FROM user_wallets WHERE coin = '$coin'";
    $user_sum_result = mysqli_query($conn, $user_sum_query);
    $user_data = mysqli_fetch_assoc($user_sum_result);
    $user_balance = floatval($user_data['total_user_balance'] ?? 0);

    // Calculate growth/difference
    $growth = 0;
    $growth_class = 'text-muted';
    $growth_symbol = '';

    if ($user_balance > 0) {
        $growth = (($platform_balance - $user_balance) / $user_balance) * 100;
        $growth_symbol = ($growth >= 0) ? '+' : '';
        $growth_class = ($growth >= 0) ? 'text-success' : 'text-danger';
    }

    $growth_percent = $growth_symbol . number_format($growth, 2) . '%';

    // Format balances
    $platform_display = number_format($platform_balance, 2);
    $user_display = number_format($user_balance, 2);

    // Set card style
    $card_class = ($status === 'Active') ? 'bg-light' : 'bg-white border';
?>
    <div class="col-sm-3 mb-3">
        <div class="card <?php echo $card_class; ?>">
            <div class="nk-wgw sm">
                <span class="nk-wgw-inner">
                    <div class="nk-wgw-name d-flex justify-content-between align-items-center">
                        <div class="nk-wgw-icon">
                            <img class="rounded-5" src="../../../assets/icons/<?php echo $icon; ?>" alt="<?php echo $coin; ?> icon">
                        </div>
                        <div class="flex-grow-1 ms-2">
                            <h5 class="nk-wgw-title title mb-0"><?php echo $coin; ?> Balance</h5>
                        </div>
                        <h6 class="mb-0 <?php echo $growth_class; ?>"><?php echo $growth_percent; ?></h6>
                    </div>

                    <div class="nk-wgw-balance">
                        <div class="amount">Platform: <?php echo $platform_display; ?>
                            <span class="currency currency-nio"><?php echo $coin; ?></span>
                        </div>
                        <div class="amount">All Users: <?php echo $user_display; ?>
                            <span class="currency currency-nio"><?php echo $coin; ?></span>
                        </div>
                    </div>
                </span>
            </div>
        </div>
    </div>
<?php } ?>


                        </div>
                        </div>
                    </div>
                </div>
            </div>
            </div>
        </div>
    </div>
<? include '../common/footer.php'; ?>

Выполнить команду


Для локальной разработки. Не используйте в интернете!