miner.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. <?php
  2. session_start();
  3. #
  4. global $miner, $port, $readonly, $notify, $rigs;
  5. #
  6. # Don't touch these 2 - see $rigs below
  7. $miner = null;
  8. $port = null;
  9. #
  10. # Set $readonly to true to force miner.php to be readonly
  11. # Set $readonly to false then it will check cgminer 'privileged'
  12. $readonly = false;
  13. #
  14. # Set $notify to false to NOT attempt to display the notify command
  15. # Set $notify to true to attempt to display the notify command
  16. # If your older version of cgminer returns an 'Invalid command'
  17. # coz it doesn't have notify - it just shows the error status table
  18. $notify = true;
  19. #
  20. # Set $rigs to an array of your cgminer rigs that are running
  21. # format: 'IP:Port' or 'Host:Port'
  22. # If you only have one rig, it will just show the detail of that rig
  23. # If you have more than one rig it will show a summary of all the rigs
  24. # with buttons to show the details of each rig
  25. # e.g. $rigs = array('127.0.0.1:4028','myrig.com:4028');
  26. $rigs = array('127.0.0.1:4028');
  27. #
  28. $here = $_SERVER['PHP_SELF'];
  29. #
  30. global $tablebegin, $tableend, $warnfont, $warnoff;
  31. $tablebegin = '<tr><td><table border=1 cellpadding=5 cellspacing=0>';
  32. $tableend = '</table></td></tr>';
  33. $warnfont = '<font color=red><b>';
  34. $warnoff = '</b></font>';
  35. #
  36. function htmlhead($checkapi)
  37. {
  38. global $error, $readonly, $here;
  39. if ($readonly === false && $checkapi === true)
  40. {
  41. $access = api('privileged');
  42. if ($error != null
  43. || !isset($access['STATUS']['STATUS'])
  44. || $access['STATUS']['STATUS'] != 'S')
  45. $readonly = true;
  46. }
  47. ?>
  48. <html><head><title>Mine</title>
  49. <style type='text/css'>
  50. td { color:blue; font-family:verdana,arial,sans; font-size:13pt; }
  51. td.h { color:blue; font-family:verdana,arial,sans; font-size:13pt; background:#d0ffff }
  52. td.err { color:black; font-family:verdana,arial,sans; font-size:13pt; background:#ff3050 }
  53. td.warn { color:black; font-family:verdana,arial,sans; font-size:13pt; background:#ffb050 }
  54. td.sta { color:green; font-family:verdana,arial,sans; font-size:13pt; }
  55. td.tot { color:blue; font-family:verdana,arial,sans; font-size:13pt; background:#fff8f2 }
  56. </style>
  57. </head><body bgcolor=#ecffff>
  58. <script type='text/javascript'>
  59. function pr(a,m){if(m!=null){if(!confirm(m+'?'))return}window.location="<?php echo $here ?>"+a}
  60. <?php
  61. if ($readonly === false && $checkapi === true)
  62. {
  63. ?>
  64. function prc(a,m){pr('?arg='+a,m)}
  65. function prs(a,r){var c=a.substr(3);var z=c.split('|',2);var m=z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' GPU '+z[1];prc(a+'&rig='+r,m)}
  66. function prs2(a,n,r){var v=document.getElementById('gi'+n).value;var c=a.substr(3);var z=c.split('|',2);var m='Set GPU '+z[1]+' '+z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' to '+v;prc(a+','+v+'&rig='+r,m)}
  67. <?php
  68. }
  69. ?>
  70. </script>
  71. <table width=100% height=100% border=0 cellpadding=0 cellspacing=0 summary='Mine'>
  72. <tr><td align=center valign=top>
  73. <table border=0 cellpadding=4 cellspacing=0 summary='Mine'>
  74. <?php
  75. }
  76. #
  77. global $error;
  78. $error = null;
  79. #
  80. function getsock($addr, $port)
  81. {
  82. global $error;
  83. $socket = null;
  84. $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  85. if ($socket === false || $socket === null)
  86. {
  87. $error = socket_strerror(socket_last_error());
  88. $msg = "socket create(TCP) failed";
  89. $error = "ERR: $msg '$error'\n";
  90. return null;
  91. }
  92. $res = socket_connect($socket, $addr, $port);
  93. if ($res === false)
  94. {
  95. $error = socket_strerror(socket_last_error());
  96. $msg = "socket connect($addr,$port) failed";
  97. $error = "ERR: $msg '$error'\n";
  98. socket_close($socket);
  99. return null;
  100. }
  101. return $socket;
  102. }
  103. #
  104. function readsockline($socket)
  105. {
  106. $line = '';
  107. while (true)
  108. {
  109. $byte = socket_read($socket, 1);
  110. if ($byte === false || $byte === '')
  111. break;
  112. if ($byte === "\0")
  113. break;
  114. $line .= $byte;
  115. }
  116. return $line;
  117. }
  118. #
  119. function api($cmd)
  120. {
  121. global $miner, $port;
  122. $socket = getsock($miner, $port);
  123. if ($socket != null)
  124. {
  125. socket_write($socket, $cmd, strlen($cmd));
  126. $line = readsockline($socket);
  127. socket_close($socket);
  128. if (strlen($line) == 0)
  129. {
  130. $error = "WARN: '$cmd' returned nothing\n";
  131. return $line;
  132. }
  133. # print "$cmd returned '$line'\n";
  134. $data = array();
  135. $objs = explode('|', $line);
  136. foreach ($objs as $obj)
  137. {
  138. if (strlen($obj) > 0)
  139. {
  140. $items = explode(',', $obj);
  141. $item = $items[0];
  142. $id = explode('=', $items[0], 2);
  143. if (count($id) == 1 or !ctype_digit($id[1]))
  144. $name = $id[0];
  145. else
  146. $name = $id[0].$id[1];
  147. if (strlen($name) == 0)
  148. $name = 'null';
  149. if (isset($data[$name]))
  150. {
  151. $num = 1;
  152. while (isset($data[$name.$num]))
  153. $num++;
  154. $name .= $num;
  155. }
  156. $counter = 0;
  157. foreach ($items as $item)
  158. {
  159. $id = explode('=', $item, 2);
  160. if (count($id) == 2)
  161. $data[$name][$id[0]] = $id[1];
  162. else
  163. $data[$name][$counter] = $id[0];
  164. $counter++;
  165. }
  166. }
  167. }
  168. return $data;
  169. }
  170. return null;
  171. }
  172. #
  173. function getparam($name, $both = false)
  174. {
  175. $a = null;
  176. if (isset($_POST[$name]))
  177. $a = $_POST[$name];
  178. if (($both === true) and ($a === null))
  179. {
  180. if (isset($_GET[$name]))
  181. $a = $_GET[$name];
  182. }
  183. if ($a == '' || $a == null)
  184. return null;
  185. // limit to 1K just to be safe
  186. return substr($a, 0, 1024);
  187. }
  188. #
  189. function fmt($section, $name, $value)
  190. {
  191. $errorclass = ' class=err';
  192. $warnclass = ' class=warn';
  193. $b = '&nbsp;';
  194. $ret = $value;
  195. $class = '';
  196. switch ($section.'.'.$name)
  197. {
  198. case 'GPU.Last Share Time':
  199. case 'PGA.Last Share Time':
  200. $ret = date('H:i:s', $value);
  201. break;
  202. case 'SUMMARY.Elapsed':
  203. $s = $value % 60;
  204. $value -= $s;
  205. $value /= 60;
  206. if ($value == 0)
  207. $ret = $s.'s';
  208. else
  209. {
  210. $m = $value % 60;
  211. $value -= $m;
  212. $value /= 60;
  213. if ($value == 0)
  214. $ret = sprintf("%dm$b%02ds", $m, $s);
  215. else
  216. {
  217. $h = $value % 24;
  218. $value -= $h;
  219. $value /= 24;
  220. if ($value == 0)
  221. $ret = sprintf("%dh$b%02dm$b%02ds", $h, $m, $s);
  222. else
  223. {
  224. if ($value == 1)
  225. $days = '';
  226. else
  227. $days = 's';
  228. $ret = sprintf("%dday$days$b%02dh$b%02dm$b%02ds", $value, $h, $m, $s);
  229. }
  230. }
  231. }
  232. break;
  233. case 'NOTIFY.Last Well':
  234. if ($value == '0')
  235. {
  236. $ret = 'Never';
  237. $class = $warnclass;
  238. }
  239. else
  240. $ret = date('H:i:s', $value);
  241. break;
  242. case 'NOTIFY.Last Not Well':
  243. if ($value == '0')
  244. $ret = 'Never';
  245. else
  246. {
  247. $ret = date('H:i:s', $value);
  248. $class = $errorclass;
  249. }
  250. break;
  251. case 'NOTIFY.Reason Not Well':
  252. if ($value != 'None')
  253. $class = $errorclass;
  254. break;
  255. case 'GPU.Utility':
  256. case 'PGA.Utility':
  257. case 'SUMMARY.Utility':
  258. $ret = $value.'/m';
  259. break;
  260. case 'GPU.Temperature':
  261. case 'PGA.Temperature':
  262. $ret = $value.'&deg;C';
  263. break;
  264. case 'GPU.MHS av':
  265. case 'PGA.MHS av':
  266. case 'SUMMARY.MHS av':
  267. case 'GPU.Total MH':
  268. case 'PGA.Total MH':
  269. case 'SUMMARY.Total MH':
  270. case 'SUMMARY.Getworks':
  271. case 'GPU.Accepted':
  272. case 'PGA.Accepted':
  273. case 'SUMMARY.Accepted':
  274. case 'GPU.Rejected':
  275. case 'PGA.Rejected':
  276. case 'SUMMARY.Rejected':
  277. case 'SUMMARY.Local Work':
  278. case 'POOL.Getworks':
  279. case 'POOL.Accepted':
  280. case 'POOL.Rejected':
  281. case 'POOL.Discarded':
  282. $parts = explode('.', $value, 2);
  283. if (count($parts) == 1)
  284. $dec = '';
  285. else
  286. $dec = '.'.$parts[1];
  287. $ret = number_format($parts[0]).$dec;
  288. break;
  289. }
  290. if ($section == 'NOTIFY' && substr($name, 0, 1) == '*' && $value != '0')
  291. $class = $errorclass;
  292. return array($ret, $class);
  293. }
  294. #
  295. global $poolcmd;
  296. $poolcmd = array( 'Switch to' => 'switchpool',
  297. 'Enable' => 'enablepool',
  298. 'Disable' => 'disablepool' );
  299. #
  300. function showhead($cmd, $item, $values)
  301. {
  302. global $poolcmd, $readonly;
  303. echo '<tr>';
  304. foreach ($values as $name => $value)
  305. {
  306. if ($name == '0')
  307. $name = '&nbsp;';
  308. echo "<td valign=bottom class=h>$name</td>";
  309. }
  310. if ($cmd == 'pools' && $readonly === false)
  311. foreach ($poolcmd as $name => $pcmd)
  312. echo "<td valign=bottom class=h>$name</td>";
  313. echo '</tr>';
  314. }
  315. #
  316. function details($cmd, $list, $rig)
  317. {
  318. global $tablebegin, $tableend;
  319. global $poolcmd, $readonly;
  320. $dfmt = 'H:i:s j-M-Y \U\T\CP';
  321. $stas = array('S' => 'Success', 'W' => 'Warning', 'I' => 'Informational', 'E' => 'Error', 'F' => 'Fatal');
  322. echo $tablebegin;
  323. echo '<tr><td class=sta>Date: '.date($dfmt).'</td></tr>';
  324. echo $tableend.$tablebegin;
  325. if (isset($list['STATUS']))
  326. {
  327. echo '<tr>';
  328. echo '<td>Computer: '.$list['STATUS']['Description'].'</td>';
  329. if (isset($list['STATUS']['When']))
  330. echo '<td>When: '.date($dfmt, $list['STATUS']['When']).'</td>';
  331. $sta = $list['STATUS']['STATUS'];
  332. echo '<td>Status: '.$stas[$sta].'</td>';
  333. echo '<td>Message: '.$list['STATUS']['Msg'].'</td>';
  334. echo '</tr>';
  335. }
  336. $section = '';
  337. foreach ($list as $item => $values)
  338. {
  339. if ($item == 'STATUS')
  340. continue;
  341. $sectionname = preg_replace('/\d/', '', $item);
  342. if ($sectionname != $section)
  343. {
  344. echo $tableend.$tablebegin;
  345. showhead($cmd, $item, $values);
  346. $section = $sectionname;
  347. }
  348. echo '<tr>';
  349. foreach ($values as $name => $value)
  350. {
  351. list($showvalue, $class) = fmt($section, $name, $value);
  352. echo "<td$class>$showvalue</td>";
  353. }
  354. if ($cmd == 'pools' && $readonly === false)
  355. {
  356. reset($values);
  357. $pool = current($values);
  358. foreach ($poolcmd as $name => $pcmd)
  359. {
  360. echo '<td>';
  361. if ($pool === false)
  362. echo '&nbsp;';
  363. else
  364. {
  365. echo "<input type=button value='Pool $pool'";
  366. echo " onclick='prc(\"$pcmd|$pool&rig=$rig\",\"$name Pool $pool\")'>";
  367. }
  368. echo '</td>';
  369. }
  370. }
  371. echo '</tr>';
  372. }
  373. echo $tableend;
  374. }
  375. #
  376. global $devs;
  377. $devs = null;
  378. #
  379. function gpubuttons($count, $rig)
  380. {
  381. global $tablebegin, $tableend;
  382. global $devs;
  383. $basic = array( 'GPU', 'Enable', 'Disable', 'Restart' );
  384. $options = array( 'intensity' => 'Intensity',
  385. 'fan' => 'Fan Percent',
  386. 'engine' => 'GPU Clock',
  387. 'mem' => 'Memory Clock',
  388. 'vddc' => 'GPU Voltage' );
  389. echo $tablebegin.'<tr>';
  390. foreach ($basic as $head)
  391. echo "<td>$head</td>";
  392. foreach ($options as $name => $des)
  393. echo "<td nowrap>$des</td>";
  394. $n = 0;
  395. for ($c = 0; $c < $count; $c++)
  396. {
  397. echo '</tr><tr>';
  398. foreach ($basic as $name)
  399. {
  400. echo '<td>';
  401. if ($name == 'GPU')
  402. echo $c;
  403. else
  404. {
  405. echo "<input type=button value='$name $c' onclick='prs(\"gpu";
  406. echo strtolower($name);
  407. echo "|$c\",$rig)'>";
  408. }
  409. echo '</td>';
  410. }
  411. foreach ($options as $name => $des)
  412. {
  413. echo '<td>';
  414. if (!isset($devs["GPU$c"][$des]))
  415. echo '&nbsp;';
  416. else
  417. {
  418. $value = $devs["GPU$c"][$des];
  419. echo "<input type=button value='Set $c:' onclick='prs2(\"gpu$name|$c\",$n,$rig)'>";
  420. echo "<input size=7 type=text name=gi$n value='$value' id=gi$n>";
  421. $n++;
  422. }
  423. echo '</td>';
  424. }
  425. }
  426. echo '</tr>'.$tableend;
  427. }
  428. #
  429. function processgpus($rig)
  430. {
  431. global $error;
  432. global $warnfont, $warnoff;
  433. $gpus = api('gpucount');
  434. if ($error != null)
  435. echo '<tr><td>Error getting GPU count: '.$warnfont.$error.$warnoff.'</td></tr>';
  436. else
  437. {
  438. if (!isset($gpus['GPUS']['Count']))
  439. echo '<tr><td>No GPU count returned: '.$warnfont.$gpus['STATUS']['STATUS'].' '.$gpus['STATUS']['Msg'].$ro.'</td></tr>';
  440. else
  441. {
  442. $count = $gpus['GPUS']['Count'];
  443. if ($count == 0)
  444. echo '<tr><td>No GPUs</td></tr>';
  445. else
  446. gpubuttons($count, $rig);
  447. }
  448. }
  449. }
  450. #
  451. function process($cmds, $rig)
  452. {
  453. global $error, $devs;
  454. global $warnfont, $warnoff;
  455. foreach ($cmds as $cmd => $des)
  456. {
  457. $process = api($cmd);
  458. if ($error != null)
  459. {
  460. echo "<tr><td colspan=100>Error getting $des: ";
  461. echo $warnfont.$error.$warnoff.'</td></tr>';
  462. break;
  463. }
  464. else
  465. {
  466. details($cmd, $process, $rig);
  467. echo '<tr><td><br><br></td></tr>';
  468. if ($cmd == 'devs')
  469. $devs = $process;
  470. }
  471. }
  472. }
  473. #
  474. # $head is a hack but this is just a demo anyway :)
  475. function doforeach($cmd, $des, $sum, $head)
  476. {
  477. global $miner, $port;
  478. global $error, $readonly, $notify, $rigs;
  479. global $tablebegin, $tableend, $warnfont, $warnoff;
  480. $header = $head;
  481. $anss = array();
  482. $count = 0;
  483. foreach ($rigs as $rig)
  484. {
  485. $parts = explode(':', $rig, 2);
  486. if (count($parts) == 2)
  487. {
  488. $miner = $parts[0];
  489. $port = $parts[1];
  490. $ans = api($cmd);
  491. if ($error != null)
  492. {
  493. echo "<tr><td colspan=100>Error on rig $count getting $des: ";
  494. echo $warnfont.$error.$warnoff.'</td></tr>';
  495. $error = null;
  496. }
  497. else
  498. $anss[$count] = $ans;
  499. }
  500. $count++;
  501. }
  502. if (count($anss) == 0)
  503. {
  504. echo "<tr><td>Failed to access any rigs successfully</td></tr>";
  505. return;
  506. }
  507. $total = array();
  508. foreach ($anss as $rig => $ans)
  509. {
  510. foreach ($ans as $item => $row)
  511. {
  512. if ($item == 'STATUS')
  513. continue;
  514. if (count($row) > count($header))
  515. {
  516. $header = $head;
  517. foreach ($row as $name => $value)
  518. if (!isset($header[$name]))
  519. $header[$name] = '';
  520. }
  521. if ($sum != null)
  522. foreach ($sum as $name)
  523. {
  524. if (isset($row[$name]))
  525. {
  526. if (isset($total[$name]))
  527. $total[$name] += $row[$name];
  528. else
  529. $total[$name] = $row[$name];
  530. }
  531. }
  532. }
  533. }
  534. if ($sum != null)
  535. $anss['total']['total'] = $total;
  536. showhead('', null, $header);
  537. $section = '';
  538. foreach ($anss as $rig => $ans)
  539. {
  540. foreach ($ans as $item => $row)
  541. {
  542. if ($item == 'STATUS')
  543. continue;
  544. echo '<tr>';
  545. $newsection = preg_replace('/\d/', '', $item);
  546. if ($newsection != 'total')
  547. $section = $newsection;
  548. foreach ($header as $name => $x)
  549. {
  550. if ($name == '')
  551. {
  552. if ($rig === 'total')
  553. echo "<td align=right class=tot>Total:</td>";
  554. else
  555. echo "<td align=right><input type=button value='Rig $rig' onclick='pr(\"?rig=$rig\",null)'></td>";
  556. }
  557. else
  558. {
  559. if (isset($row[$name]))
  560. list($showvalue, $class) = fmt($section, $name, $row[$name]);
  561. else
  562. {
  563. $class = '';
  564. $showvalue = '&nbsp;';
  565. }
  566. if ($rig === 'total' and $class == '')
  567. $class = ' class=tot';
  568. echo "<td$class align=right>$showvalue</td>";
  569. }
  570. }
  571. echo '</tr>';
  572. }
  573. }
  574. }
  575. #
  576. function doOne($rig, $preprocess)
  577. {
  578. global $error, $readonly, $notify;
  579. global $rigs;
  580. htmlhead(true);
  581. $error = null;
  582. echo "<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td>";
  583. echo "<input type=button value='Refresh' onclick='pr(\"?rig=$rig\",null)'></td>";
  584. if (count($rigs) > 1)
  585. echo "<td><input type=button value='Summary' onclick='pr(\"\",null)'></td>";
  586. echo "<td width=100%>&nbsp;</td><td>";
  587. if ($readonly === false)
  588. {
  589. $msg = 'Quit CGMiner';
  590. if (count($rigs) > 1)
  591. $msg .= " Rig $rig";
  592. echo "<input type=button value='Quit' onclick='prc(\"quit&rig=$rig\",\"$msg\")'>";
  593. }
  594. echo "</td></tr></table></td></tr>";
  595. if ($preprocess != null)
  596. process(array($preprocess => $preprocess), $rig);
  597. $cmds = array( 'devs' => 'device list',
  598. 'summary' => 'summary information',
  599. 'pools' => 'pool list');
  600. if ($notify)
  601. $cmds['notify'] = 'device status';
  602. $cmds['config'] = 'cgminer config';
  603. process($cmds, $rig);
  604. if ($error == null && $readonly === false)
  605. processgpus($rig);
  606. }
  607. #
  608. function display()
  609. {
  610. global $tablebegin, $tableend;
  611. global $miner, $port;
  612. global $error, $readonly, $notify, $rigs;
  613. $rig = trim(getparam('rig', true));
  614. $arg = trim(getparam('arg', true));
  615. $preprocess = null;
  616. if ($arg != null and $arg != '')
  617. {
  618. $num = null;
  619. if ($rig != null and $rig != '')
  620. {
  621. if ($rig >= 0 and $rig < count($rigs))
  622. $num = $rig;
  623. }
  624. else
  625. if (count($rigs) == 0)
  626. $num = 0;
  627. if ($num != null)
  628. {
  629. $parts = explode(':', $rigs[$num], 2);
  630. if (count($parts) == 2)
  631. {
  632. $miner = $parts[0];
  633. $port = $parts[1];
  634. $preprocess = $arg;
  635. }
  636. }
  637. }
  638. if ($rigs == null or count($rigs) == 0)
  639. {
  640. echo "<tr><td>No rigs defined</td></tr>";
  641. return;
  642. }
  643. if (count($rigs) == 1)
  644. {
  645. $parts = explode(':', $rigs[0], 2);
  646. if (count($parts) == 2)
  647. {
  648. $miner = $parts[0];
  649. $port = $parts[1];
  650. doOne(0, $preprocess);
  651. }
  652. else
  653. echo '<tr><td>Invalid "$rigs" array</td></tr>';
  654. return;
  655. }
  656. if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs))
  657. {
  658. $parts = explode(':', $rigs[$rig], 2);
  659. if (count($parts) == 2)
  660. {
  661. $miner = $parts[0];
  662. $port = $parts[1];
  663. doOne($rig, $preprocess);
  664. }
  665. else
  666. echo '<tr><td>Invalid "$rigs" array</td></tr>';
  667. return;
  668. }
  669. htmlhead(false);
  670. echo "<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td>";
  671. echo "<input type=button value='Refresh' onclick='pr(\"\",null)'>";
  672. echo "</td></tr></table></td></tr>";
  673. if ($preprocess != null)
  674. process(array($preprocess => $preprocess), $rig);
  675. echo $tablebegin;
  676. $sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH');
  677. doforeach('summary', 'summary information', $sum, array());
  678. echo $tableend;
  679. echo '<tr><td><br><br></td></tr>';
  680. echo $tablebegin;
  681. doforeach('devs', 'device list', $sum, array(''=>'','ID'=>'','Name'=>''));
  682. echo $tableend;
  683. echo '<tr><td><br><br></td></tr>';
  684. echo $tablebegin;
  685. doforeach('pools', 'pool list', $sum, array(''=>''));
  686. echo $tableend;
  687. }
  688. #
  689. display();
  690. #
  691. ?>
  692. </table></td></tr></table>
  693. </body></html>