Add pool switching to example miner.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/miner.php b/miner.php
index 8ba2b4e..7674fff 100644
--- a/miner.php
+++ b/miner.php
@@ -2,8 +2,12 @@
session_start();
#
global $miner, $port;
-$miner = '127.0.0.1'; # hostname or IP address
+#$miner = '127.0.0.1'; # hostname or IP address
+#$miner = 'ernie.paige'; # hostname or IP address
+$miner = 'subaru.paige'; # hostname or IP address
+#$miner = 'evilming.paige'; # hostname or IP address
$port = 4028;
+#$port = 4029;
#
$here = $_SERVER['PHP_SELF'];
#
@@ -17,8 +21,9 @@ td.sta { color:green; font-family:verdana,arial,sans; font-size:14pt; }
</head><body bgcolor=#ecffff>
<script type='text/javascript'>
function pr(a,m){if(m!=null){if(!confirm(m+'?'))return}window.location="<? echo $here ?>"+a}
-function prs(a){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];pr('?arg='+a,m)}
-function prs2(a,n){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;pr('?arg='+a+','+v,m)}
+function prc(a,m){pr('?arg='+a,m)}
+function prs(a){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,m)}
+function prs2(a,n){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,m)}
</script>
<table width=100% height=100% border=0 cellpadding=0 cellspacing=0 summary='Mine'>
<tr><td align=center valign=top>
@@ -201,7 +206,7 @@ function fmt($section, $name, $value)
return $value;
}
#
-function details($list)
+function details($cmd, $list)
{
$stas = array('S' => 'Success', 'W' => 'Warning', 'I' => 'Informational', 'E' => 'Error', 'F' => 'Fatal');
@@ -243,6 +248,9 @@ function details($list)
echo "<td valign=bottom class=h>$name</td>";
}
+ if ($cmd == 'pools')
+ echo "<td valign=bottom class=h>Switch</td>";
+
echo '</tr>';
break;
@@ -257,6 +265,23 @@ function details($list)
foreach ($values as $name => $value)
echo '<td>'.fmt($section, $name, $value).'</td>';
+ if ($cmd == 'pools')
+ {
+ echo '<td>';
+
+ reset($values);
+ $pool = current($values);
+ if ($pool === false)
+ echo ' ';
+ else
+ {
+ echo "<input type=button value='Pool $pool'";
+ echo " onclick='prc(\"switchpool|$pool\",\"Switch to Pool $pool\")'>";
+ }
+
+ echo '</td>';
+ }
+
echo '</tr>';
}
echo $te;
@@ -369,7 +394,7 @@ function process($cmds, $rd, $ro)
}
else
{
- details($process);
+ details($cmd, $process);
echo '<tr><td><br><br></td></tr>';
if ($cmd == 'devs')
$devs = $process;
@@ -389,7 +414,7 @@ function display()
echo "<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td>";
echo "<input type=button value='Refresh' onclick='pr(\"\",null)'>";
echo "</td><td width=100%> </td><td>";
- echo "<input type=button value='Quit' onclick='pr(\"?arg=quit\",\"Quit CGMiner\")'>";
+ echo "<input type=button value='Quit' onclick='prc(\"quit\",\"Quit CGMiner\")'>";
echo "</td></tr></table></td></tr>";
$arg = trim(getparam('arg', true));