--- alx-src/branches/alx-web-060/index.php 2011/06/15 13:14:25 2415 +++ alx-src/branches/alx-web-070/index.php 2015/12/14 08:24:42 7996 @@ -1,10 +1,15 @@ include('include/basesql.php'); +include('include/common-functions.php'); + session_start(); -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'); +$_SESSION['alx_sort_krit'] = $alx_sort_krit; +$_SESSION['alx_sort_onfirst'] = $alx_sort_onfirst; +$_SESSION['alx_sort_loc'] = $alx_sort_loc; -$locations = sqlarr('SELECT location FROM client_locations', '', 'location'); +$locations = sqlarr('SELECT location FROM client_locations where enabled="1"', '', 'location'); $locations[] = ''; if($_SESSION['alx_sort_krit']==null) @@ -25,11 +30,14 @@ function check_online($dat, $bla) { global $comps; - global $pingcmd; + global $ssh_port; + global $mcore_port; + global $ping_timeout; if(!isset($comps[$dat['serial']])) return false; - //passthru("/bin/ping -I eth0 -c 1 -W 1 -q ".$dat['ip']." &> /dev/null && exit 0 || exit 1",$retval); - passthru($pingcmd." ".$dat['ip']." &> /dev/null && exit 0 || exit 1",$retval); + // first try mcore, then get ssh + $retval = ping_host($dat['ip'],$mcore_port,$ping_timeout); + if($retval==1) $retval = ping_host($dat['ip'],$ssh_port,$ping_timeout); if($retval==0) { $comps[$dat['serial']]['online'] = true; @@ -66,8 +74,8 @@ } $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"); - -sqlforeach('SELECT serial, ip, hostname, mac FROM state_connected', 'check_online', null); + +sqlforeach('SELECT state_connected.serial, state_connected.ip, cfg_network.hostname, state_connected.mac FROM state_connected left join cfg_network on cfg_network.serial=state_connected.serial', 'check_online', null); usort($comps, 'sortcomp'); echo ''; @@ -111,7 +119,9 @@ echo '
edit | serial | hostname | ip | last connected | '; +echo '|||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
edit | serial | hostname | ip | mac | last connected | '; +//always enable showversion atm +$showversion = "on"; if($showversion=='on') echo 'version | '; echo 'up/down | ||||||||||
'; - echo ' | '.substr($c['location'],0,1).' | '; + echo ''.substr($c['location'],0,3).' | '; echo '![]() | ';
echo '#'.$c['serial'].' | '; echo ''; - if($c['online']) + if($showversion=='on') { - if($showversion=='on') - { - $osver = sshdo('os_ver=$('.$osver[0].''; - echo ' | '.$osver[1].' | '; - } + // get alx version info for + $alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$c['serial']); + $alxver = $alxinfo[os]; + $alxutils = $alxinfo[utils]; + +// if( $alxver == '') +// { +// if($c['online']) +// { +// //$alxinfo = @sshdo('os_ver=$('.$alxver.''; + echo ''.$alxutils.' | '; } echo ''; @@ -165,7 +187,7 @@ else echo ''; echo ' | '; - echo '