Greetings all, especially dudes and dudettes from Telegram XMG chat

while waiting for public tests etc i had some free time to make really simple dashboard where you can monitor your workers and see some coin prices.
Sorry if the code is not looking tidy etc, this was just for fun, but since there is the interest in this, i am posting it here
You just need to change XXX and YYYY from these API endpoints to work for your account
https://xmg.minerclaim.net/index.php?page=api&action=getuserbalance&api_key=XXX&id=
YYYYTop prices table can be changed too, just modify arrays for symbols you want to see

Cheers!
https://i.imgur.com/3LbXgsw.jpg<?php
function api_get($url,$request=array(),$content='text/xml') {
$curlopt_useragent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: $content"));
//curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
//curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo '<hr/>Curl error: ' . curl_error($ch) . '<hr/>';
}
curl_close($ch);
return json_decode($response,true);
}
$currenciesAPI=array(
'BTC'=>array(
'prices'=>api_get('https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=BTC,USD,EUR'),
),
'ETH'=>array(
'prices'=>api_get('https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=BTC,USD,EUR'),
),
'OTN'=>array(
'prices'=>api_get('https://min-api.cryptocompare.com/data/price?fsym=OTN&tsyms=BTC,USD,EUR'),
),
'XMG'=>array(
'prices'=>api_get('https://min-api.cryptocompare.com/data/price?fsym=XMG&tsyms=BTC,USD,EUR'),
),
);
$balanceXMG=api_get('https://xmg.minerclaim.net/index.php?page=api&action=getuserbalance&api_key=XXX&id=YYYY');
$workers=api_get('https://xmg.minerclaim.net/index.php?page=api&action=getuserworkers&api_key=XXX&id=YYYY');
$hashrate=api_get('https://xmg.minerclaim.net/index.php?page=api&action=getuserhashrate&api_key=XXX&id=YYYY');
?>
<!doctype html>
<html lang="en">
<head>
<title>AJ's Crypto Monitor</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" href="http://jakobdesign.com/grafika/logo.png">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row align-items-start justify-content-md-center">
<div class="col col-lg-4">
<div class="alert alert-info" role="alert">
<h4>AJ's Crypto Monitor</h4>
</div>
</div>
<div class="col-lg-8">
<table class="table table-striped table-dark table-bordered table-hover">
<thead class="bg-info">
<tr class="">
<th class="text-center">Coin Symbol</th>
<th class="text-center">BTC</th>
<th class="text-center">USD</th>
<th class="text-center">EUR</th>
</tr>
</thead>
<tbody>
<?php
foreach($currenciesAPI as $key=>$value){
?>
<tr>
<td class="text-center"><?php echo $key;?></td>
<td class="text-right"><?php echo sprintf('%.8f', $value['prices']['BTC']);?></td>
<td class="text-right"><?php echo sprintf('%.4f', $value['prices']['USD']);?></td>
<td class="text-right"><?php echo sprintf('%.4f', $value['prices']['EUR']);?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<div class="row align-items-start justify-content-md-center">
<div class="col col-lg-4">
<div class="alert alert-primary" role="alert">
<h5>XMG Mining pool</h5>
<div>
xmg.minerclaim.net
</div>
<hr/>
<div class="row">
<div class="col">
<b>Current price</b>
</div>
<div class="col">
<div class="float-right">
<?php echo round($currenciesAPI['XMG']['prices']['USD'],4); ?> <b>$</b>
</div>
<div class="clearfix"></div>
<div class="float-right">
<?php echo round($currenciesAPI['XMG']['prices']['EUR'],4); ?> <b></b>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="alert alert-info" role="alert">
My total hashrate: <?php echo $hashrate['getuserhashrate']['data'] ; ?> <b>KH/s</b>
</div>
<div class="alert alert-success" role="alert">
<h5>Confirmed balance</h5>
<hr/>
<div class="row">
<div class="col">
<?php echo sprintf('%.8f', $balanceXMG['getuserbalance']['data']['confirmed']) ; ?> <b>XMG</b>
</div>
<div class="col">
<div class="float-right">
<?php echo round($balanceXMG['getuserbalance']['data']['confirmed']*$currenciesAPI['XMG']['prices']['USD'],4); ?> <b>$</b>
</div>
<div class="clearfix"></div>
<div class="float-right">
<?php echo round($balanceXMG['getuserbalance']['data']['confirmed']*$currenciesAPI['XMG']['prices']['EUR'],4); ?> <b></b>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="alert alert-warning" role="alert">
<h5>Unconfirmed balance</h5>
<hr/>
<div class="row">
<div class="col">
<?php echo sprintf('%.8f', $balanceXMG['getuserbalance']['data']['unconfirmed']) ; ?> <b>XMG</b>
</div>
<div class="col">
<div class="float-right">
<?php echo round($balanceXMG['getuserbalance']['data']['unconfirmed']*$currenciesAPI['XMG']['prices']['USD'],4); ?> <b>$</b>
</div>
<div class="clearfix"></div>
<div class="float-right">
<?php echo round($balanceXMG['getuserbalance']['data']['unconfirmed']*$currenciesAPI['XMG']['prices']['EUR'],4); ?> <b></b>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="alert alert-secondary" role="alert">
<h5>Orphaned balance</h5>
<hr/>
<div class="row">
<div class="col">
<?php echo sprintf('%.8f', $balanceXMG['getuserbalance']['data']['orphaned']) ; ?> <b>XMG</b>
</div>
<div class="col">
<div class="float-right">
<?php echo round($balanceXMG['getuserbalance']['data']['orphaned']*$currenciesAPI['XMG']['prices']['USD'],4); ?> <b>$</b>
</div>
<div class="clearfix"></div>
<div class="float-right">
<?php echo round($balanceXMG['getuserbalance']['data']['orphaned']*$currenciesAPI['XMG']['prices']['EUR'],4); ?> <b></b>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<table class="table table-striped table-dark table-bordered table-hover">
<thead class="bg-info">
<tr class="">
<th>Worker</th>
<th>Status</th>
<th>Hashrate</th>
<th>Difficulty</th>
</tr>
</thead>
<tbody>
<?php
//testing online:
//$workers['getuserworkers']['data'][2]['hashrate']=12.2;
foreach($workers['getuserworkers']['data'] as $w){
?>
<tr <?php echo (($w['hashrate']==0)?' class="bg-warning"':'');?>>
<td><?php echo $w['username'];?></td>
<td <?php echo (($w['hashrate']==0)?' class="bg-danger"':' class="bg-success"');?>><?php echo (($w['hashrate']==0)?'offline':'online');?></td>
<td class="text-right"><?php echo $w['hashrate'];?> <b>KH/s</b></td>
<td class="text-right"><?php echo sprintf('%.8f',$w['difficulty']);?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>