';
$warnfont = '';
$warnoff = '';
$dfmt = 'H:i:s j-M-Y \U\T\CP';
#
$miner_font_family = 'verdana,arial,sans';
$miner_font_size = '13pt';
#
# Edit this or redefine it in myminer.php to change the colour scheme
# See $colourtable below for the list of names
$colouroverride = array();
#
# Where to place the buttons: 'top' 'bot' 'both'
# anything else means don't show them - case sensitive
$placebuttons = 'top';
#
# This below allows you to put your own settings into a seperate file
# so you don't need to update miner.php with your preferred settings
# every time a new version is released
# Just create the file 'myminer.php' in the same directory as
# 'miner.php' - and put your own settings in there
if (file_exists('myminer.php'))
include_once('myminer.php');
#
# This is the system default that must always contain all necessary
# colours so it must be a constant
# You can override these values with $colouroverride
# The only one missing is in $warnfont
# - which you can override directly anyway
global $colourtable;
$colourtable = array(
'body bgcolor' => '#ecffff',
'td color' => 'blue',
'td.two color' => 'blue',
'td.two background' => '#ecffff',
'td.h color' => 'blue',
'td.h background' => '#c4ffff',
'td.err color' => 'black',
'td.err background' => '#ff3050',
'td.warn color' => 'black',
'td.warn background' => '#ffb050',
'td.sta color' => 'green',
'td.tot color' => 'blue',
'td.tot background' => '#fff8f2',
'td.lst color' => 'blue',
'td.lst background' => '#ffffdd',
'td.hi color' => 'blue',
'td.hi background' => '#f6ffff',
'td.lo color' => 'blue',
'td.lo background' => '#deffff'
);
#
# Don't touch these 2
$miner = null;
$port = null;
#
# Ensure it is only ever shown once
global $showndate;
$showndate = false;
#
# For summary page to stop retrying failed rigs
global $rigerror;
$rigerror = array();
#
global $rownum;
$rownum = 0;
#
// Login
global $ses;
$ses = 'rutroh';
#
function getcss($cssname, $dom = false)
{
global $colourtable, $colouroverride;
$css = '';
foreach ($colourtable as $cssdata => $value)
{
$cssobj = explode(' ', $cssdata, 2);
if ($cssobj[0] == $cssname)
{
if (isset($colouroverride[$cssdata]))
$value = $colouroverride[$cssdata];
if ($dom == true)
$css .= ' '.$cssobj[1].'='.$value;
else
$css .= $cssobj[1].':'.$value.'; ';
}
}
return $css;
}
#
function getdom($domname)
{
return getcss($domname, true);
}
#
function htmlhead($checkapi, $rig, $pg = null, $noscript = false)
{
global $title, $miner_font_family, $miner_font_size;
global $error, $readonly, $poolinputs, $here;
global $ignorerefresh, $autorefresh;
$extraparams = '';
if ($rig != null && $rig != '')
$extraparams = "&rig=$rig";
else
if ($pg != null && $pg != '')
$extraparams = "&pg=$pg";
if ($ignorerefresh == true || $autorefresh == 0)
$refreshmeta = '';
else
{
$url = "$here?ref=$autorefresh$extraparams";
$refreshmeta = "\n";
}
if ($readonly === false && $checkapi === true)
{
$error = null;
$access = api($rig, 'privileged');
if ($error != null
|| !isset($access['STATUS']['STATUS'])
|| $access['STATUS']['STATUS'] != 'S')
$readonly = true;
}
$miner_font = "font-family:$miner_font_family; font-size:$miner_font_size;";
echo "$refreshmeta
$title
\n";
if ($noscript === false)
{
echo "\n";
}
?>
$socksndtimeoutsec, 'usec' => 0));
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $sockrcvtimeoutsec, 'usec' => 0));
$res = socket_connect($socket, $addr, $port);
if ($res === false)
{
$haderror = true;
if ($rigipsecurity === false)
{
$error = socket_strerror(socket_last_error());
$msg = "socket connect($addr,$port) failed";
$error = "ERR: $msg '$error'\n";
}
else
$error = "ERR: socket connect($rig) failed\n";
socket_close($socket);
return null;
}
return $socket;
}
#
function readsockline($socket)
{
$line = '';
while (true)
{
$byte = socket_read($socket, 1);
if ($byte === false || $byte === '')
break;
if ($byte === "\0")
break;
$line .= $byte;
}
return $line;
}
#
function api_convert_escape($str)
{
$res = '';
$len = strlen($str);
for ($i = 0; $i < $len; $i++)
{
$ch = substr($str, $i, 1);
if ($ch != '\\' || $i == ($len-1))
$res .= $ch;
else
{
$i++;
$ch = substr($str, $i, 1);
switch ($ch)
{
case '|':
$res .= "\1";
break;
case '\\':
$res .= "\2";
break;
case '=':
$res .= "\3";
break;
case ',':
$res .= "\4";
break;
default:
$res .= $ch;
}
}
}
return $res;
}
#
function revert($str)
{
return str_replace(array("\1", "\2", "\3", "\4"), array("|", "\\", "=", ","), $str);
}
#
function api($rig, $cmd)
{
global $haderror, $error;
global $miner, $port, $hidefields;
$socket = getsock($rig, $miner, $port);
if ($socket != null)
{
socket_write($socket, $cmd, strlen($cmd));
$line = readsockline($socket);
socket_close($socket);
if (strlen($line) == 0)
{
$haderror = true;
$error = "WARN: '$cmd' returned nothing\n";
return $line;
}
# print "$cmd returned '$line'\n";
$line = api_convert_escape($line);
$data = array();
$objs = explode('|', $line);
foreach ($objs as $obj)
{
if (strlen($obj) > 0)
{
$items = explode(',', $obj);
$item = $items[0];
$id = explode('=', $items[0], 2);
if (count($id) == 1 or !ctype_digit($id[1]))
$name = $id[0];
else
$name = $id[0].$id[1];
if (strlen($name) == 0)
$name = 'null';
$sectionname = preg_replace('/\d/', '', $name);
if (isset($data[$name]))
{
$num = 1;
while (isset($data[$name.$num]))
$num++;
$name .= $num;
}
$counter = 0;
foreach ($items as $item)
{
$id = explode('=', $item, 2);
if (isset($hidefields[$sectionname.'.'.$id[0]]))
continue;
if (count($id) == 2)
$data[$name][$id[0]] = revert($id[1]);
else
$data[$name][$counter] = $id[0];
$counter++;
}
}
}
return $data;
}
return null;
}
#
function getparam($name, $both = false)
{
$a = null;
if (isset($_POST[$name]))
$a = $_POST[$name];
if (($both === true) and ($a === null))
{
if (isset($_GET[$name]))
$a = $_GET[$name];
}
if ($a == '' || $a == null)
return null;
// limit to 1K just to be safe
return substr($a, 0, 1024);
}
#
function newtable()
{
global $tablebegin, $rownum;
echo $tablebegin;
$rownum = 0;
}
#
function newrow()
{
echo '
';
}
#
function otherrow($row)
{
echo "
$row
";
}
#
function endrow()
{
global $rownum;
echo '';
$rownum++;
}
#
function endtable()
{
global $tableend;
echo $tableend;
}
#
function classlastshare($when, $alldata, $warnclass, $errorclass)
{
global $checklastshare;
if ($checklastshare === false)
return '';
if ($when == 0)
return '';
if (!isset($alldata['MHS av']))
return '';
if ($alldata['MHS av'] == 0)
return '';
if (!isset($alldata['Last Share Time']))
return '';
if (!isset($alldata['Last Share Difficulty']))
return '';
$expected = pow(2, 32) / ($alldata['MHS av'] * pow(10, 6));
// If the share difficulty changes while waiting on a share,
// this calculation will of course be incorrect
$expected *= $alldata['Last Share Difficulty'];
$howlong = $when - $alldata['Last Share Time'];
if ($howlong < 1)
$howlong = 1;
if ($howlong > ($expected * 12))
return $errorclass;
if ($howlong > ($expected * 8))
return $warnclass;
return '';
}
#
function fmt($section, $name, $value, $when, $alldata)
{
global $dfmt, $rownum;
if ($alldata == null)
$alldata = array();
$errorclass = ' class=err';
$warnclass = ' class=warn';
$lstclass = ' class=lst';
$hiclass = ' class=hi';
$loclass = ' class=lo';
$c2class = ' class=two';
$totclass = ' class=tot';
$b = ' ';
$ret = $value;
$class = '';
$nams = explode('.', $name);
if (count($nams) > 1)
$name = $nams[count($nams)-1];
if ($value === null)
$ret = $b;
else
switch ($section.'.'.$name)
{
case 'GPU.Last Share Time':
case 'PGA.Last Share Time':
case 'DEVS.Last Share Time':
if ($value == 0
|| (isset($alldata['Last Share Pool']) && $alldata['Last Share Pool'] == -1))
{
$ret = 'Never';
$class = $warnclass;
}
else
{
$ret = date('H:i:s', $value);
$class = classlastshare($when, $alldata, $warnclass, $errorclass);
}
break;
case 'POOL.Last Share Time':
if ($value == 0)
$ret = 'Never';
else
$ret = date('H:i:s d-M', $value);
break;
case 'GPU.Last Share Pool':
case 'PGA.Last Share Pool':
case 'DEVS.Last Share Pool':
if ($value == -1)
{
$ret = 'None';
$class = $warnclass;
}
break;
case 'SUMMARY.Elapsed':
case 'STATS.Elapsed':
$s = $value % 60;
$value -= $s;
$value /= 60;
if ($value == 0)
$ret = $s.'s';
else
{
$m = $value % 60;
$value -= $m;
$value /= 60;
if ($value == 0)
$ret = sprintf("%dm$b%02ds", $m, $s);
else
{
$h = $value % 24;
$value -= $h;
$value /= 24;
if ($value == 0)
$ret = sprintf("%dh$b%02dm$b%02ds", $h, $m, $s);
else
{
if ($value == 1)
$days = '';
else
$days = 's';
$ret = sprintf("%dday$days$b%02dh$b%02dm$b%02ds", $value, $h, $m, $s);
}
}
}
break;
case 'NOTIFY.Last Well':
if ($value == '0')
{
$ret = 'Never';
$class = $warnclass;
}
else
$ret = date('H:i:s', $value);
break;
case 'NOTIFY.Last Not Well':
if ($value == '0')
$ret = 'Never';
else
{
$ret = date('H:i:s', $value);
$class = $errorclass;
}
break;
case 'NOTIFY.Reason Not Well':
if ($value != 'None')
$class = $errorclass;
break;
case 'GPU.Utility':
case 'PGA.Utility':
case 'DEVS.Utility':
case 'SUMMARY.Utility':
case 'total.Utility':
$ret = $value.'/m';
if ($value == 0)
$class = $errorclass;
else
if (isset($alldata['Difficulty Accepted'])
&& isset($alldata['Accepted'])
&& isset($alldata['MHS av'])
&& ($alldata['Difficulty Accepted'] > 0)
&& ($alldata['Accepted'] > 0))
{
$expected = 60 * $alldata['MHS av'] * (pow(10, 6) / pow(2, 32));
if ($expected == 0)
$expected = 0.000001; // 1 H/s
$da = $alldata['Difficulty Accepted'];
$a = $alldata['Accepted'];
$expected /= ($da / $a);
$ratio = $value / $expected;
if ($ratio < 0.9)
$class = $loclass;
else
if ($ratio > 1.1)
$class = $hiclass;
}
break;
case 'SUMMARY.Work Utility':
case 'total.Work Utility':
$ret = $value.'/m';
break;
case 'PGA.Temperature':
case 'GPU.Temperature':
case 'DEVS.Temperature':
$ret = $value.'°C';
if (!isset($alldata['GPU']))
break;
case 'GPU.GPU Clock':
case 'DEVS.GPU Clock':
case 'GPU.Memory Clock':
case 'DEVS.Memory Clock':
case 'GPU.GPU Voltage':
case 'DEVS.GPU Voltage':
case 'GPU.GPU Activity':
case 'DEVS.GPU Activity':
if ($value == 0)
$class = $warnclass;
break;
case 'GPU.Fan Percent':
case 'DEVS.Fan Percent':
if ($value == 0)
$class = $warnclass;
else
{
if ($value == 100)
$class = $errorclass;
else
if ($value > 85)
$class = $warnclass;
}
break;
case 'GPU.Fan Speed':
case 'DEVS.Fan Speed':
if ($value == 0)
$class = $warnclass;
else
if (isset($alldata['Fan Percent']))
{
$test = $alldata['Fan Percent'];
if ($test == 100)
$class = $errorclass;
else
if ($test > 85)
$class = $warnclass;
}
break;
case 'GPU.MHS av':
case 'PGA.MHS av':
case 'DEVS.MHS av':
case 'SUMMARY.MHS av':
case 'total.MHS av':
$parts = explode('.', $value, 2);
if (count($parts) == 1)
$dec = '';
else
$dec = '.'.$parts[1];
$ret = number_format((float)$parts[0]).$dec;
if ($value == 0)
$class = $errorclass;
else
if (isset($alldata['Difficulty Accepted'])
&& isset($alldata['Accepted'])
&& isset($alldata['Utility'])
&& ($alldata['Difficulty Accepted'] > 0)
&& ($alldata['Accepted'] > 0))
{
$expected = 60 * $value * (pow(10, 6) / pow(2, 32));
if ($expected == 0)
$expected = 0.000001; // 1 H/s
$da = $alldata['Difficulty Accepted'];
$a = $alldata['Accepted'];
$expected /= ($da / $a);
$ratio = $alldata['Utility'] / $expected;
if ($ratio < 0.9)
$class = $hiclass;
else
if ($ratio > 1.1)
$class = $loclass;
}
break;
case 'GPU.Total MH':
case 'PGA.Total MH':
case 'DEVS.Total MH':
case 'SUMMARY.Total MH':
case 'total.Total MH':
case 'SUMMARY.Getworks':
case 'POOL.Getworks':
case 'total.Getworks':
case 'GPU.Accepted':
case 'PGA.Accepted':
case 'DEVS.Accepted':
case 'SUMMARY.Accepted':
case 'POOL.Accepted':
case 'total.Accepted':
case 'GPU.Rejected':
case 'PGA.Rejected':
case 'DEVS.Rejected':
case 'SUMMARY.Rejected':
case 'POOL.Rejected':
case 'total.Rejected':
case 'SUMMARY.Local Work':
case 'total.Local Work':
case 'SUMMARY.Discarded':
case 'POOL.Discarded':
case 'total.Discarded':
case 'POOL.Diff1 Shares':
case 'total.Diff1 Shares':
case 'GPU.Diff1 Work':
case 'PGA.Diff1 Work':
case 'total.Diff1 Work':
case 'STATS.Times Sent':
case 'STATS.Bytes Sent':
case 'STATS.Net Bytes Sent':
case 'STATS.Times Recv':
case 'STATS.Bytes Recv':
case 'STATS.Net Bytes Recv':
case 'total.Times Sent':
case 'total.Bytes Sent':
case 'total.Net Bytes Sent':
case 'total.Times Recv':
case 'total.Bytes Recv':
case 'total.Net Bytes Recv':
$parts = explode('.', $value, 2);
if (count($parts) == 1)
$dec = '';
else
$dec = '.'.$parts[1];
$ret = number_format((float)$parts[0]).$dec;
break;
case 'GPU.Status':
case 'PGA.Status':
case 'DEVS.Status':
case 'POOL.Status':
if ($value != 'Alive')
$class = $errorclass;
break;
case 'GPU.Enabled':
case 'PGA.Enabled':
case 'DEVS.Enabled':
if ($value != 'Y')
$class = $warnclass;
break;
case 'STATUS.When':
case 'COIN.Current Block Time':
$ret = date($dfmt, $value);
break;
case 'BUTTON.Rig':
case 'BUTTON.Pool':
case 'BUTTON.GPU':
$ret = $value;
break;
case 'SUMMARY.Difficulty Accepted':
case 'GPU.Difficulty Accepted':
case 'PGA.Difficulty Accepted':
case 'DEVS.Difficulty Accepted':
case 'POOL.Difficulty Accepted':
case 'total.Difficulty Accepted':
case 'SUMMARY.Difficulty Rejected':
case 'GPU.Difficulty Rejected':
case 'PGA.Difficulty Rejected':
case 'DEVS.Difficulty Rejected':
case 'POOL.Difficulty Rejected':
case 'total.Difficulty Rejected':
case 'SUMMARY.Difficulty Stale':
case 'POOL.Difficulty Stale':
case 'total.Difficulty Stale':
case 'GPU.Last Share Difficulty':
case 'PGA.Last Share Difficulty':
case 'DEVS.Last Share Difficulty':
case 'POOL.Last Share Difficulty':
if ($value != '')
$ret = number_format((float)$value, 2);
break;
}
if ($section == 'NOTIFY' && substr($name, 0, 1) == '*' && $value != '0')
$class = $errorclass;
if ($class == '' && $section != 'POOL')
$class = classlastshare($when, $alldata, $lstclass, $lstclass);
if ($class == '' && $section == 'total')
$class = $totclass;
if ($class == '' && ($rownum % 2) == 0)
$class = $c2class;
if ($ret === '')
$ret = $b;
return array($ret, $class);
}
#
global $poolcmd;
$poolcmd = array( 'Switch to' => 'switchpool',
'Enable' => 'enablepool',
'Disable' => 'disablepool',
'Remove' => 'removepool' );
#
function showhead($cmd, $values, $justnames = false)
{
global $poolcmd, $readonly;
newrow();
foreach ($values as $name => $value)
{
if ($name == '0' or $name == '')
$name = ' ';
echo "
";
endrow();
if (count($ans) > 1)
{
newrow();
echo '
Set pool priorities:
';
echo "
Comma list of pool numbers: ";
echo "
";
endrow();
}
endtable();
}
#
function process($cmds, $rig)
{
global $error, $devs;
global $warnfont, $warnoff;
$count = count($cmds);
foreach ($cmds as $cmd => $des)
{
$process = api($rig, $cmd);
if ($error != null)
{
otherrow("
Error getting $des: $warnfont$error$warnoff
");
break;
}
else
{
details($cmd, $process, $rig);
if ($cmd == 'devs')
$devs = $process;
if ($cmd == 'pools')
showpoolinputs($rig, $process);
# Not after the last one
if (--$count > 0)
otherrow('
";
}
endrow();
}
return $total;
}
#
function docalc($func, $data)
{
switch ($func)
{
case 'sum':
$tot = 0;
foreach ($data as $val)
$tot += $val;
return $tot;
case 'avg':
$tot = 0;
foreach ($data as $val)
$tot += $val;
return ($tot / count($data));
case 'min':
$ans = null;
foreach ($data as $val)
if ($ans === null)
$ans = $val;
else
if ($val < $ans)
$ans = $val;
return $ans;
case 'max':
$ans = null;
foreach ($data as $val)
if ($ans === null)
$ans = $val;
else
if ($val > $ans)
$ans = $val;
return $ans;
case 'lo':
$ans = null;
foreach ($data as $val)
if ($ans === null)
$ans = $val;
else
if (strcasecmp($val, $ans) < 0)
$ans = $val;
return $ans;
case 'hi':
$ans = null;
foreach ($data as $val)
if ($ans === null)
$ans = $val;
else
if (strcasecmp($val, $ans) > 0)
$ans = $val;
return $ans;
case 'any':
default:
return $data[0];
}
}
#
function docompare($row, $test)
{
// invalid $test data means true
if (count($test) < 2)
return true;
if (isset($row[$test[0]]))
$val = $row[$test[0]];
else
$val = null;
if ($test[1] == 'set')
return ($val !== null);
if ($val === null || count($test) < 3)
return true;
switch($test[1])
{
case '=':
return ($val == $test[2]);
case '<':
return ($val < $test[2]);
case '<=':
return ($val <= $test[2]);
case '>':
return ($val > $test[2]);
case '>=':
return ($val >= $test[2]);
case 'eq':
return (strcasecmp($val, $test[2]) == 0);
case 'lt':
return (strcasecmp($val, $test[2]) < 0);
case 'le':
return (strcasecmp($val, $test[2]) <= 0);
case 'gt':
return (strcasecmp($val, $test[2]) > 0);
case 'ge':
return (strcasecmp($val, $test[2]) >= 0);
default:
return true;
}
}
#
function processcompare($which, $ext, $section, $res)
{
if (isset($ext[$section][$which]))
{
$proc = $ext[$section][$which];
if ($proc !== null)
{
$res2 = array();
foreach ($res as $rig => $result)
foreach ($result as $sec => $row)
{
$secname = preg_replace('/\d/', '', $sec);
if (!secmatch($section, $secname))
$res2[$rig][$sec] = $row;
else
{
$keep = true;
foreach ($proc as $test)
if (!docompare($row, $test))
{
$keep = false;
break;
}
if ($keep)
$res2[$rig][$sec] = $row;
}
}
$res = $res2;
}
}
return $res;
}
#
function processext($ext, $section, $res)
{
$res = processcompare('where', $ext, $section, $res);
if (isset($ext[$section]['group']))
{
$grp = $ext[$section]['group'];
$calc = $ext[$section]['calc'];
if ($grp !== null)
{
$interim = array();
$res2 = array();
$cou = 0;
foreach ($res as $rig => $result)
foreach ($result as $sec => $row)
{
$secname = preg_replace('/\d/', '', $sec);
if (!secmatch($section, $secname))
{
// STATUS may be problematic ...
if (!isset($res2[$sec]))
$res2[$sec] = $row;
}
else
{
$grpkey = '';
$newrow = array();
foreach ($grp as $field)
{
if (isset($row[$field]))
{
$grpkey .= $row[$field].'.';
$newrow[$field] = $row[$field];
}
else
$grpkey .= '.';
}
if (!isset($interim[$grpkey]))
{
$interim[$grpkey]['grp'] = $newrow;
$interim[$grpkey]['sec'] = $secname.$cou;
$cou++;
}
if ($calc !== null)
foreach ($calc as $field => $func)
{
if (!isset($interim[$grpkey]['cal'][$field]))
$interim[$grpkey]['cal'][$field] = array();
$interim[$grpkey]['cal'][$field][] = $row[$field];
}
}
}
// Build the rest of $res2 from $interim
foreach ($interim as $rowkey => $row)
{
$key = $row['sec'];
foreach ($row['grp'] as $field => $value)
$res2[$key][$field] = $value;
foreach ($row['cal'] as $field => $data)
$res2[$key][$field] = docalc($calc[$field], $data);
}
$res = array('' => $res2);
}
}
return processcompare('having', $ext, $section, $res);
}
#
function processcustompage($pagename, $sections, $sum, $ext, $namemap)
{
global $sectionmap;
global $miner, $port;
global $rigs, $error;
global $warnfont, $warnoff;
global $dfmt;
global $readonly, $showndate;
$cmds = array();
$errors = array();
foreach ($sections as $section => $fields)
{
$all = explode('+', $section);
foreach ($all as $section)
{
if (isset($sectionmap[$section]))
{
$cmd = $sectionmap[$section];
if (!isset($cmds[$cmd]))
$cmds[$cmd] = 1;
}
else
if ($section != 'DATE')
$errors[] = "Error: unknown section '$section' in custom summary page '$pagename'";
}
}
$results = array();
foreach ($rigs as $num => $rig)
{
$parts = explode(':', $rig, 3);
if (count($parts) >= 2)
{
$miner = $parts[0];
$port = $parts[1];
if (count($parts) > 2)
$name = $parts[2];
else
$name = $rig;
foreach ($cmds as $cmd => $one)
{
$process = api($name, $cmd);
if ($error != null)
{
$errors[] = "Error getting $cmd for $name $warnfont$error$warnoff";
break;
}
else
$results[$cmd][$num] = $process;
}
}
}
$shownsomething = false;
if (count($results) > 0)
{
list($results, $errors) = joinsections($sections, $results, $errors);
$first = true;
foreach ($sections as $section => $fields)
{
if ($section === 'DATE')
{
if ($shownsomething)
otherrow('
');
newtable();
showdatetime();
endtable();
// On top of the next table
$shownsomething = false;
continue;
}
if ($section === 'RIGS')
{
if ($shownsomething)
otherrow('
');
newtable();
showrigs($results['version'], 'Rig', '');
endtable();
$shownsomething = true;
continue;
}
if (isset($results[$sectionmap[$section]]))
{
$rigresults = processext($ext, $section, $results[$sectionmap[$section]]);
$showfields = array();
$showhead = array();
foreach ($fields as $field)
foreach ($rigresults as $result)
foreach ($result as $sec => $row)
{
$secname = preg_replace('/\d/', '', $sec);
if (secmatch($section, $secname))
{
if ($field === '*')
{
foreach ($row as $f => $v)
{
$showfields[$f] = 1;
$map = $section.'.'.$f;
if (isset($namemap[$map]))
$showhead[$namemap[$map]] = 1;
else
$showhead[$f] = 1;
}
}
elseif (isset($row[$field]))
{
$showfields[$field] = 1;
$map = $section.'.'.$field;
if (isset($namemap[$map]))
$showhead[$namemap[$map]] = 1;
else
$showhead[$field] = 1;
}
}
}
if (count($showfields) > 0)
{
if ($shownsomething)
otherrow('