|
|
@ -2,7 +2,7 @@ |
|
|
|
session_start(); |
|
|
|
session_start(); |
|
|
|
# |
|
|
|
# |
|
|
|
global $title, $miner, $port, $readonly, $notify, $rigs; |
|
|
|
global $title, $miner, $port, $readonly, $notify, $rigs; |
|
|
|
global $rigtotals, $forcerigtotals; |
|
|
|
global $rgisecurity, $rigtotals, $forcerigtotals; |
|
|
|
global $socksndtimeoutsec, $sockrcvtimeoutsec; |
|
|
|
global $socksndtimeoutsec, $sockrcvtimeoutsec; |
|
|
|
global $checklastshare, $poolinputs, $hidefields; |
|
|
|
global $checklastshare, $poolinputs, $hidefields; |
|
|
|
global $ignorerefresh, $changerefresh, $autorefresh; |
|
|
|
global $ignorerefresh, $changerefresh, $autorefresh; |
|
|
@ -40,6 +40,10 @@ $poolinputs = false; |
|
|
|
# format: 'IP:Port' or 'Host:Port' or 'Host:Port:Name' |
|
|
|
# format: 'IP:Port' or 'Host:Port' or 'Host:Port:Name' |
|
|
|
$rigs = array('127.0.0.1:4028'); |
|
|
|
$rigs = array('127.0.0.1:4028'); |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
# Set $rigipsecurity to false to show the IP/Port of the rig |
|
|
|
|
|
|
|
# in the socket error messages and also show the full socket message |
|
|
|
|
|
|
|
$rigipsecurity = true; |
|
|
|
|
|
|
|
# |
|
|
|
# Set $rigtotals to true to display totals on the single rig page |
|
|
|
# Set $rigtotals to true to display totals on the single rig page |
|
|
|
# 'false' means no totals (and ignores $forcerigtotals) |
|
|
|
# 'false' means no totals (and ignores $forcerigtotals) |
|
|
|
# You can force it to always show rig totals when there is only |
|
|
|
# You can force it to always show rig totals when there is only |
|
|
@ -226,7 +230,7 @@ function htmlhead($checkapi, $rig, $pg = null) |
|
|
|
if ($readonly === false && $checkapi === true) |
|
|
|
if ($readonly === false && $checkapi === true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$error = null; |
|
|
|
$error = null; |
|
|
|
$access = api('privileged'); |
|
|
|
$access = api($rig, 'privileged'); |
|
|
|
if ($error != null |
|
|
|
if ($error != null |
|
|
|
|| !isset($access['STATUS']['STATUS']) |
|
|
|
|| !isset($access['STATUS']['STATUS']) |
|
|
|
|| $access['STATUS']['STATUS'] != 'S') |
|
|
|
|| $access['STATUS']['STATUS'] != 'S') |
|
|
@ -275,8 +279,9 @@ global $haderror, $error; |
|
|
|
$haderror = false; |
|
|
|
$haderror = false; |
|
|
|
$error = null; |
|
|
|
$error = null; |
|
|
|
# |
|
|
|
# |
|
|
|
function getsock($addr, $port) |
|
|
|
function getsock($rig, $addr, $port) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
global $rigipsecurity; |
|
|
|
global $haderror, $error, $socksndtimeoutsec, $sockrcvtimeoutsec; |
|
|
|
global $haderror, $error, $socksndtimeoutsec, $sockrcvtimeoutsec; |
|
|
|
|
|
|
|
|
|
|
|
$error = null; |
|
|
|
$error = null; |
|
|
@ -285,9 +290,15 @@ function getsock($addr, $port) |
|
|
|
if ($socket === false || $socket === null) |
|
|
|
if ($socket === false || $socket === null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$haderror = true; |
|
|
|
$haderror = true; |
|
|
|
|
|
|
|
if ($rigipsecurity === false) |
|
|
|
|
|
|
|
{ |
|
|
|
$error = socket_strerror(socket_last_error()); |
|
|
|
$error = socket_strerror(socket_last_error()); |
|
|
|
$msg = "socket create(TCP) failed"; |
|
|
|
$msg = "socket create(TCP) failed"; |
|
|
|
$error = "ERR: $msg '$error'\n"; |
|
|
|
$error = "ERR: $msg '$error'\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$error = "ERR: socket create(TCP) failed\n"; |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -301,9 +312,15 @@ function getsock($addr, $port) |
|
|
|
if ($res === false) |
|
|
|
if ($res === false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$haderror = true; |
|
|
|
$haderror = true; |
|
|
|
|
|
|
|
if ($rigipsecurity === false) |
|
|
|
|
|
|
|
{ |
|
|
|
$error = socket_strerror(socket_last_error()); |
|
|
|
$error = socket_strerror(socket_last_error()); |
|
|
|
$msg = "socket connect($addr,$port) failed"; |
|
|
|
$msg = "socket connect($addr,$port) failed"; |
|
|
|
$error = "ERR: $msg '$error'\n"; |
|
|
|
$error = "ERR: $msg '$error'\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$error = "ERR: socket connect($rig) failed\n"; |
|
|
|
|
|
|
|
|
|
|
|
socket_close($socket); |
|
|
|
socket_close($socket); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -365,12 +382,12 @@ function revert($str) |
|
|
|
return str_replace(array("\1", "\2", "\3", "\4"), array("|", "\\", "=", ","), $str); |
|
|
|
return str_replace(array("\1", "\2", "\3", "\4"), array("|", "\\", "=", ","), $str); |
|
|
|
} |
|
|
|
} |
|
|
|
# |
|
|
|
# |
|
|
|
function api($cmd) |
|
|
|
function api($rig, $cmd) |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $haderror, $error; |
|
|
|
global $haderror, $error; |
|
|
|
global $miner, $port, $hidefields; |
|
|
|
global $miner, $port, $hidefields; |
|
|
|
|
|
|
|
|
|
|
|
$socket = getsock($miner, $port); |
|
|
|
$socket = getsock($rig, $miner, $port); |
|
|
|
if ($socket != null) |
|
|
|
if ($socket != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
socket_write($socket, $cmd, strlen($cmd)); |
|
|
|
socket_write($socket, $cmd, strlen($cmd)); |
|
|
@ -1071,7 +1088,7 @@ function processgpus($rig) |
|
|
|
global $error; |
|
|
|
global $error; |
|
|
|
global $warnfont, $warnoff; |
|
|
|
global $warnfont, $warnoff; |
|
|
|
|
|
|
|
|
|
|
|
$gpus = api('gpucount'); |
|
|
|
$gpus = api($rig, 'gpucount'); |
|
|
|
|
|
|
|
|
|
|
|
if ($error != null) |
|
|
|
if ($error != null) |
|
|
|
otherrow("<td>Error getting GPU count: $warnfont$error$warnoff</td>"); |
|
|
|
otherrow("<td>Error getting GPU count: $warnfont$error$warnoff</td>"); |
|
|
@ -1140,7 +1157,7 @@ function process($cmds, $rig) |
|
|
|
$count = count($cmds); |
|
|
|
$count = count($cmds); |
|
|
|
foreach ($cmds as $cmd => $des) |
|
|
|
foreach ($cmds as $cmd => $des) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$process = api($cmd); |
|
|
|
$process = api($rig, $cmd); |
|
|
|
|
|
|
|
|
|
|
|
if ($error != null) |
|
|
|
if ($error != null) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1255,7 +1272,7 @@ function doforeach($cmd, $des, $sum, $head, $datetime) |
|
|
|
else |
|
|
|
else |
|
|
|
$name = $num; |
|
|
|
$name = $num; |
|
|
|
|
|
|
|
|
|
|
|
$ans = api($cmd); |
|
|
|
$ans = api($name, $cmd); |
|
|
|
|
|
|
|
|
|
|
|
if ($error != null) |
|
|
|
if ($error != null) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1767,7 +1784,7 @@ function processcustompage($pagename, $sections, $sum, $namemap) |
|
|
|
|
|
|
|
|
|
|
|
foreach ($cmds as $cmd => $one) |
|
|
|
foreach ($cmds as $cmd => $one) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$process = api($cmd); |
|
|
|
$process = api($name, $cmd); |
|
|
|
|
|
|
|
|
|
|
|
if ($error != null) |
|
|
|
if ($error != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|