1 |
<? |
<? |
2 |
|
|
3 |
include('include/basesql.php'); |
include('include/basesql.php'); |
4 |
|
include('include/common-functions.php'); |
5 |
|
|
6 |
session_start(); |
session_start(); |
7 |
session_register('alx_sort_krit'); session_register('alx_sort_onfirst'); session_register('alx_sort_loc'); |
session_register('alx_sort_krit'); session_register('alx_sort_onfirst'); session_register('alx_sort_loc'); |
8 |
|
|
68 |
} |
} |
69 |
|
|
70 |
$comps = sqlarr("select client_serials.serial, client_serials.location, client_serials.mac, cfg_network.hostname, state_connected.mtime from client_serials left join cfg_network on client_serials.serial=cfg_network.serial left join state_connected on client_serials.serial=state_connected.serial", "serial"); |
$comps = sqlarr("select client_serials.serial, client_serials.location, client_serials.mac, cfg_network.hostname, state_connected.mtime from client_serials left join cfg_network on client_serials.serial=cfg_network.serial left join state_connected on client_serials.serial=state_connected.serial", "serial"); |
71 |
|
|
72 |
sqlforeach('SELECT serial, ip, hostname, mac FROM state_connected', 'check_online', null); |
sqlforeach('SELECT serial, ip, hostname, mac FROM state_connected', 'check_online', null); |
73 |
usort($comps, 'sortcomp'); |
usort($comps, 'sortcomp'); |
74 |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
114 |
|
|
115 |
echo '<table border="1" id="mytab">'; |
echo '<table border="1" id="mytab">'; |
116 |
echo '<thead><tr style="font-weight:bold;background-color:#d5e5ff"><th>edit</th><th colspan=3>serial</th><th width=170>hostname</th><th width=100>ip</th><th width=100>last connected</th>'; |
echo '<thead><tr style="font-weight:bold;background-color:#d5e5ff"><th>edit</th><th colspan=3>serial</th><th width=170>hostname</th><th width=100>ip</th><th width=100>last connected</th>'; |
117 |
|
//always enable showversion atm |
118 |
|
$showversion = "on"; |
119 |
if($showversion=='on') echo '<th colspan=2>version</th>'; |
if($showversion=='on') echo '<th colspan=2>version</th>'; |
120 |
echo '<th width=150>up/down</th></tr></thead><tbody>'; |
echo '<th width=150>up/down</th></tr></thead><tbody>'; |
121 |
|
|
145 |
//if($c['mtime']) { echo '<td><nobr>'.$c['mtime'].'</nobr></td>'; } |
//if($c['mtime']) { echo '<td><nobr>'.$c['mtime'].'</nobr></td>'; } |
146 |
else echo '<td></td>'; |
else echo '<td></td>'; |
147 |
|
|
148 |
if($c['online']) |
if($showversion=='on') |
149 |
{ |
{ |
150 |
if($showversion=='on') |
// get alx version info for |
151 |
|
$alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$c['serial']); |
152 |
|
$alxver = $alxinfo[os]; |
153 |
|
$alxutils = $alxinfo[utils]; |
154 |
|
|
155 |
|
if( $alxver == '') |
156 |
{ |
{ |
157 |
$osver = sshdo('os_ver=$(</etc/mageversion);cfg_ver=$(/sbin/magequery -n alxconfig-ng | cut -d" " -f5);pname=${cfg_ver%-*-*};cfg_ver=${cfg_ver/${pname}-};echo "${os_ver}:${cfg_ver}"', $c['ip']); |
if($c['online']) |
158 |
$osver = explode(':',$osver[1]); |
{ |
159 |
if($osver[0] == '') $osver[0]='unkown'; |
//$alxinfo = @sshdo('os_ver=$(</etc/mageversion);cfg_ver=$(/sbin/magequery -n alxconfig-ng | cut -d" " -f5);pname=${cfg_ver%-*-*};cfg_ver=${cfg_ver/${pname}-};echo "${os_ver}:${cfg_ver}"', $c['ip']); |
160 |
if($osver[1] == '') $osver[1]='unkown'; |
//$alxinfo = explode(':',$alxinfo[1]); |
161 |
echo '<td>'.$osver[0].'</td>'; |
//$alxver = $alxinfo[0]; |
162 |
echo '<td>'.$osver[1].'</td>'; |
//$alxutils = $alxinfo[1]; |
163 |
} |
} |
164 |
|
} |
165 |
|
if($alxver == '') $alxver='unkown'; |
166 |
|
if($alxutils == '') $alxutils='unkown'; |
167 |
|
|
168 |
|
echo '<td>'.$alxver.'</td>'; |
169 |
|
echo '<td>'.$alxutils.'</td>'; |
170 |
} |
} |
171 |
|
|
172 |
echo '<td>'; |
echo '<td>'; |