Skip to content

Commit

Permalink
updated display to show price in usb or btc
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Dec 2, 2013
1 parent d925aa8 commit 2fad5dd
Show file tree
Hide file tree
Showing 5 changed files with 367 additions and 29 deletions.
37 changes: 32 additions & 5 deletions admin/bitcoind.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,40 @@
<label>Blocks</label>
<?php echo $info['blocks'];?>
</div>
<div class="infoLine">
<label>Balance</label>
<?php echo number_format($info['balance'],8,".",","); echo " ".$coin_code[$x];?>
</div>
<?php
$pair2 = '';
switch ($coin_code[$x]) {
case 'BTC';
case 'NMC';
case 'LTC';
$pair2 = 'USD';
break;
default;
$pair2 = 'BTC';
break;
}
$pref = '';
if ($pair2 == 'USD') {
$pref='$';
}
$sql = "SELECT `value` FROM config WHERE `key` = '".$coin_code[$x]."';";
$q = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
while($r = mysqli_fetch_assoc($q)){
$rate = $r['value'];
}
if (isset($rate)){
$usd = $rate * $info['balance'];
$usd = number_format($usd,2,'.',',');
}
echo "<div class='infoLine'>".PHP_EOL;
echo "<label>Balance</label>".PHP_EOL;
echo number_format($info['balance'],8,".",","); echo " ".$coin_code[$x];
if (isset($rate)){
echo " <font color='gray' title='Rate: {$pref}{$rate} {$pair2}'>".$pref.$usd." ".$pair2."</font>";
}
echo "</div>".PHP_EOL;
$users_balance = 0;
$sql = "SELECT `balance` FROM accounts WHERE account_type = '".$coin_code[$x]."'";
$sql = "SELECT `balance` FROM accounts WHERE account_type = '".$coin_code[$x]."';";
$q = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
while($r = mysqli_fetch_assoc($q)){
$users_balance += $r['balance'];
Expand Down
62 changes: 45 additions & 17 deletions forms/send.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
<?php
defined("_V") || die("Direct access not allowed!");
include("menus/menus.php");
for ($x=0; $x < count($coin_list); $x++){
if ($account_to_edit['account_type'] == $coin_code[$x]){
$code = $coin_code[$x];
$num = $x;
}

#echo "<option value='".$x."'>".$coin_code[$x]."</option>".PHP_EOL;
}

switch ($code) {
case 'BTC';
case 'NMC';
case 'LTC';
$pair2 = 'USD';
break;
default;
$pair2 = 'BTC';
break;
}
$pref = '';
if ($pair2 == 'USD') {
$pref='$';
}
$sql = "SELECT `value` FROM config WHERE `key` = '".$code."';";
$q = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
while($r = mysqli_fetch_assoc($q)){
$rate = $r['value'];
}
?>
<div id="mainBodyLMenu">
<h2>Send Coins</h2>
Expand All @@ -24,6 +52,16 @@ function validateWithdraw(form){
return true;

}
window.onload=function(){
var input = document.getElementById('amount');
input.onkeyup = function () {
var result = document.getElementById('usd');
result.innerHTML = "<?php echo $pref; ?>"+eval(this.value*<?php echo $rate; ?>)+" <?php echo $pair2; ?>";
};

//evaluate initial value
//input.onkeyup();
}
</script>
<p>The maximum amount you can withdraw is <strong><?php echo number_format($available,8,".",",");?></strong></p>
<form method="post" action="index.php" onsubmit="return validateWithdraw(this)">
Expand All @@ -34,15 +72,10 @@ function validateWithdraw(form){
</div>
<div class="formLine">
<label>Amount</label>
<input type="text" style="text-align: right;" name="amount" size="10">
<?php
for ($x=0; $x < count($coin_list); $x++){
if ($account_to_edit['account_type'] == $coin_code[$x]){
echo $coin_code[$x];
}
}

<input type="text" style="text-align: right;" name="amount" size="10" id="amount">
<?php echo $code;
?>
<span id="usd"></span>
</div>
<div class="formLine">
<label>Your Password</label>
Expand All @@ -51,16 +84,11 @@ function validateWithdraw(form){
<div class="formLine">
<label>Account Type</label>
<select name="account_type">
<?php
for ($x=0; $x < count($coin_list); $x++){
if ($account_to_edit['account_type'] == $coin_code[$x]){
echo "<option value='".$x."'";
<?php
echo "<option value='".$num."'";
echo " selected";
echo ">".$coin_code[$x]."</option>".PHP_EOL;
}

#echo "<option value='".$x."'>".$coin_code[$x]."</option>".PHP_EOL;
} ?>
echo ">".$code."</option>".PHP_EOL;
?>
</select>
</div>
<div class="formLine">
Expand Down
33 changes: 31 additions & 2 deletions html/accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@
while($r = mysqli_fetch_assoc($q)){
$total_accounts += $r['balance'];
$accounts++;
switch ($coin_code[$x]) {
case 'BTC';
case 'NMC';
case 'LTC';
$pair2 = 'USD';
break;
default;
$pair2 = 'BTC';
break;
}
$pref = '';
if ($pair2 == 'USD') {
$pref='$';
}
$sql = "SELECT `value` FROM config WHERE `key` = '".$coin_code[$x]."';";
$q = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
while($z = mysqli_fetch_assoc($q)){
$rate = $z['value'];
}
?>
<tr class="listingRow<?php echo $k;?>">
<td align="right"><?php echo $r['account_id'];?></td>
Expand All @@ -47,7 +66,13 @@
<img src="icon/<?php echo $r['forward'] == 1 ? 'tick.png' : 'cross.png';?>" border="0" title="<?php echo $r['forward'] == 1 ? 'Yes' : 'No';?>" alt="<?php echo $r['forward'] == 1 ? 'Yes' : 'No';?>">
</td>
<td><?php echo $r['forward'] == 1 ? $r['forward_to'] : "<i>not forwarded</i>";?></td>
<td align="right"><?php echo number_format($r['balance'],8,".",","); echo " ".$coin_code[$x];?></td>
<td align="right"<?php
if (isset($rate)){
echo " title='".$pref.number_format($r['balance']*$rate,2,".",",")." ".$pair2."'";
}
echo ">".number_format($r['balance'],8,".",",");
echo " ".$coin_code[$x];
?></td>
<td>
<img src="icon/blue-document--pencil.png" border="0" title="Edit account" style="cursor: pointer;" onclick="document.location.href='index.php?f=editAccount&amp;account_id=<?php echo $r['id'];?>'" alt="Edit Account">
</td>
Expand All @@ -58,7 +83,11 @@
}
?>
</table>
<h4>Total amount in accounts: <?php echo number_format($total_accounts,8,".",","); echo " ".$coin_code[$x];?></h4>
<h4>Total amount in accounts: <?php echo number_format($total_accounts,8,".",","); echo " ".$coin_code[$x];
if (isset($rate)) {
echo " <font color='gray' title='Rate: {$pref}{$rate} {$pair2}'>".$pref.number_format($total_accounts*$rate,2,".",",")." ".$pair2."</font>";
}
?></h4>
<?php
}
?>
Expand Down
44 changes: 39 additions & 5 deletions html/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,44 @@
<div class="infoLine">
<label>Balance</label>
<strong>
END;
switch ($coin_code[$x]) {
case 'BTC';
case 'NMC';
case 'LTC';
$pair2 = 'USD';
break;
default;
$pair2 = 'BTC';
break;
}
$pref = '';
if ($pair2 == 'USD') {
$pref='$';
}
$sql = "SELECT `value` FROM config WHERE `key` = '".$coin_code[$x]."';";
$q = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
while($r = mysqli_fetch_assoc($q)){
$rate = $r['value'];
}
if (isset($rate)) {
$usd = $rate * $accountBalance;
$usd = number_format($usd,2,'.',',');
$incomming = $b[$x]->getbalance($_SESSION['btaccount'],0) * $rate;

}

echo "<strong>".PHP_EOL;
echo number_format($accountBalance,8,".",",");
echo " ".$coin_code[$x]."</strong> <small><i>";
echo " ".$coin_code[$x]."</strong>".PHP_EOL;
if (isset($rate)) {
echo " <font color='gray' title='Rate: {$pref}{$rate} {$pair2}'>".$pref.$usd." ".$pair2."</font>";
}
echo " <small><i";
if(isset($incomming)) {
echo "title='{$pref}{$incomming} {$pair2}'";
}
echo ">";
echo number_format($b[$x]->getbalance($_SESSION['btaccount'],0),8,".",".");
echo $coin_code[$x];
$coin_sufx = $coin_code[$x];
Expand Down Expand Up @@ -130,9 +164,9 @@
<td><?php echo $r['dtime'];?></td>
<td><?php echo stripslashes($r['description']);?></td>
<td align="right"><?php echo $r['txblock'];?> (<?php echo $cBlock - $r['txblock'];?> conf.)</td>
<td align="right"><?php echo $r['credit'] == 1 ? "&nbsp;" : number_format($r['amount'],8,".",",") . " ".$coin_sufx;?></td>
<td align="right"><?php echo $r['credit'] == 0 ? "&nbsp;" : number_format($r['amount'],8,".",",") . " ".$coin_sufx;?></td>
<td align="right"><?php echo number_format($r['balance'],8,".",",") . " ".$coin_sufx;?></td>
<td align="right"<?php if ($r['credit'] == 1 ) { echo ">&nbsp;"; } else { if (isset($rate)) { echo " title='".$pref.number_format($r['amount']*$rate,2,".",",")." ".$pair2."'";} echo ">".number_format($r['amount'],8,".",",") . " ".$coin_sufx;}?></td>
<td align="right"<?php if ($r['credit'] == 0 ) { echo ">&nbsp;"; } else { if (isset($rate)) { echo " title='".$pref.number_format($r['amount']*$rate,2,".",",")." ".$pair2."'";} echo ">".number_format($r['amount'],8,".",",") . " ".$coin_sufx;}?></td>
<td align="right"<?php if (isset($rate)) { echo " title='".$pref.number_format($r['balance']*$rate,2,".",",")." ".$pair2."'";} echo ">".number_format($r['balance'],8,".",",") . " ".$coin_sufx;?></td>
</tr>
<?php
$k = 1 - $k;
Expand Down
Loading

0 comments on commit 2fad5dd

Please sign in to comment.