foreach ($r['status']['devs'] as $id => $dev) { $devices += $dev['MHS5s'] > 0 ? 1 : 0; // Only count hashing devices $MHS5s += $dev['MHS5s']; $MHSav += $dev['MHSav']; $Accepted += $dev['Accepted']; $Rejected += $dev['Rejected']; $HardwareErrors += $dev['HardwareErrors']; $Utility += $dev['Utility']; $r['status']['devs'][$id]['TotalShares'] = $dev['Accepted'] + $dev['Rejected'] + $dev['HardwareErrors']; } } $r['status']['dtot'] = array('devices' => $devices, 'MHS5s' => $MHS5s, 'MHSav' => $MHSav, 'Accepted' => $Accepted, 'Rejected' => $Rejected, 'HardwareErrors' => $HardwareErrors, 'Utility' => $Utility, 'TotalShares' => $Accepted + $Rejected + $HardwareErrors); // CPU intensive stuff if (!empty($_REQUEST['all'])) { $ret = sys_getloadavg(); $r['status']['pi']['load'] = $ret[2]; $ret = explode(' ', exec('cat /proc/uptime')); $r['status']['pi']['uptime'] = $ret[0]; $r['status']['pi']['temp'] = exec('cat /sys/class/thermal/thermal_zone0/temp') / 1000; // What other interesting stuff is in summary? $summary = bfgminer('summary'); if (!empty($summary['data']['SUMMARY'][0]['Elapsed'])) { $r['status']['uptime'] = $summary['data']['SUMMARY'][0]['Elapsed']; } else { $r['status']['uptime'] = 0; } } $r['status']['time'] = time(); //ChromePhp::log($r); echo json_encode($r);
<?php session_start(); if (!isset($_SESSION['_logged_']) || $_SESSION['_logged_'] === false) { echo json_encode(false); die; } /* f_copy issues a command to the api of the miner returns success, command, miner response and possible errors */ header('Content-type: application/json'); include 'inc/bfgminer.inc.php'; if (empty($_REQUEST['command']) && empty($_REQUEST['parameter'])) { $r = bfgminer(); } elseif (empty($_REQUEST['parameter'])) { $r = bfgminer($_REQUEST['command']); } else { $r = bfgminer($_REQUEST['command'], $_REQUEST['parameter']); } echo json_encode($r);