= 86400) return sprintf("%0.2f days", $sec/86400); $hrs = intdiv($sec, 3600); $sec %= 3600; $min = intdiv($sec, 60); $sec %= 60; if ($hrs) return sprintf("%2d hr %2d min %2d sec", $hrs, $min, $sec); if ($min) return sprintf("%2d min %2d sec", $min, $sec); return sprintf("%2d sec", $sec); } function MyAndSfxToQrz(string $my, string $sfx) { $my = trim($my); $sfx = trim($sfx); if (0 == strlen($my)) { $my = 'Empty MYCall '; } else { if (strpos($my, ' ')) $link = strstr($my, ' ', true); else $link = $my; if (strlen($sfx)) $my .= '/'.$sfx; $len = strlen($my); $my = ''.$my.''; while ($len < 13) { $my .= ' '; $len += 1; } } return $my; } ParseKVFile($cfgdir.'/qn.cfg', $cfg); ParseKVFile($cfgdir.'/defaults', $defaults); ?> QnetGateway Dashboard

QnetGateway Dashboard

2) { echo 'Processes:
', "\n"; echo str_replace(' ', ' ', 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
'), "\n"; $lines = explode("\n", `ps -aux | grep -e qngateway -e qnlink -e qndtmf -e qndvap -e qnitap -e qnrelay -e qndvrptr -e qnmodem -e MMDVMHost | grep -v grep`); foreach ($lines as $line) { echo str_replace(' ', ' ', $line), "
\n"; } echo '
', "\n"; } if ('true' == GetCFGValue('dash_show_lh')) { echo 'Last Heard:
', "\n"; $rstr = 'MyCall/Sfx Source Last Time
'; echo str_replace(' ', ' ', $rstr), "\n"; $dbname = $cfgdir.'/'.GetCFGValue('dash_sql_filename'); $db = new SQLite3($dbname, SQLITE3_OPEN_READONLY); $ss = 'SELECT mycall,sfx,urcall,strftime("%s","now")-lasttime FROM LHEARD ORDER BY 4 LIMIT '.GetCFGValue('dash_lastheard_count').' '; if ($stmnt = $db->prepare($ss)) { if ($result = $stmnt->execute()) { while ($row = $result->FetchArray(SQLITE3_NUM)) { $source = ("CQCQCQ " == $row[2]) ? "Linking" : "Routing"; $rstr = MyAndSfxToQrz($row[0], $row[1]).' '.$source.' '.SecToString(intval($row[3])).'
'; echo str_replace('*', ' ', str_replace(' ', ' ', $rstr)), "\n"; } $result->finalize(); } $stmnt->close(); } $db->Close(); echo '

', "\n"; } if ('true' == GetCFGValue('dash_show_ip')) { echo 'IP Addresses:
', "\n"; echo '', "\n"; echo '', "\n"; echo '', "\n"; echo '
InternalIPV4IPV6
', GetIP('internal'), '', GetIP('ipv4'), '', GetIP('ipv6'), '

', "\n"; } if ('true' == GetCFGValue('dash_show_mo')) { echo 'Modules:
', "\n"; echo "\n"; echo '', "\n"; foreach (array('a', 'b', 'c') as $mod) { $module = 'module_'.$mod; if (array_key_exists($module, $cfg)) { $configured[] = strtoupper($mod); $freq = 0.0; if (array_key_exists($module.'_tx_frequency', $cfg)) $freq = $cfg[$module.'_tx_frequency']; else if (array_key_exists($module.'_frequency', $cfg)) $freq = $cfg[$module.'_frequency']; $stat = GetStatus($mod, $cfg); if (8==strlen($stat[1]) && 1==strlen($stat[2])) $linkstatus = substr($stat[1], 0, 7).$stat[2]; else $linkstatus = 'Unlinked'; echo '',"\n"; } } echo '
ModuleModemFrequencyRepeaterRepeater IP
',strtoupper($mod),'',$cfg[$module],'',$freq,'',$linkstatus,'',$stat[3],'

', "\n"; } if ('true' == GetCFGValue('dash_show_ur')) { echo 'Send URCall:
', "\n"; echo '
', "\n"; if (count($configured) > 1) { echo 'Module: ', "\n"; foreach ($configured as $mod) { echo '', $mod, '
', "\n"; } } else $fmodule = $configured[0]; echo 'URCall: ', "\n"; echo '
', "\n"; echo '
', "\n"; if (isset($_POST['sendurcall'])) { $furcall = $_POST['furcall']; if (empty($_POST['fmodule'])) { if (1==count($configured)) { $fmodule = $configured[0]; } } else { $fmodule = $_POST['fmodule']; } } $furcall = str_replace(' ', '_', trim(preg_replace('/[^0-9a-z_ ]/', '', strtolower($furcall)))); if (strlen($furcall)>0 && strlen($fmodule)>0) { $command = 'qnremote '.strtolower($fmodule).' '.strtolower($cfg['ircddb_login']).' '.$furcall; echo $command, "
\n"; $unused = `$command`; } } ?>

QnetGateway Dashboard Version 2.0 Copyright © by Thomas A. Early, N7TAE.