--- alx-src/branches/alx-web-070/index.php 2015/09/07 10:50:48 7070 +++ alx-src/branches/alx-web-070/index.php 2017/04/06 12:34:29 9460 @@ -4,9 +4,15 @@ 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'); +if(isset($_SESSION['alx_sort_krit'])) $alx_sort_krit = $_SESSION['alx_sort_krit']; +if(isset($_SESSION['alx_sort_onfirst'])) $alx_sort_onfirst = $_SESSION['alx_sort_onfirst']; +if(isset($_SESSION['alx_sort_loc'])) $alx_sort_loc = $_SESSION['alx_sort_loc']; -$locations = sqlarr('SELECT location FROM client_locations', '', 'location'); +// fix reload php debug message +if(!isset($reload)) $reload = 'not set'; + +$locations = sqlarr('SELECT location FROM client_locations where enabled="1"', '', 'location'); $locations[] = ''; if($_SESSION['alx_sort_krit']==null) @@ -27,11 +33,11 @@ function check_online($dat, $bla) { global $comps; - global $pingcmd; + 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); + $retval = ping_host($dat['ip'],$mcore_port,$ping_timeout); if($retval==0) { $comps[$dat['serial']]['online'] = true; @@ -50,8 +56,8 @@ if($_SESSION['alx_sort_onfirst']) { - if($a['online'] && !$b['online']) return -1; - if($b['online'] && !$a['online']) return 1; + if(isset($a['online']) && !isset($b['online'])) return -1; + if(isset($b['online']) && !isset($a['online'])) return 1; } if($_SESSION['alx_sort_krit']=='hostname') { @@ -67,12 +73,12 @@ else return ''; } -$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.enabled, client_serials.location, client_serials.mac, cfg_network.hostname, state_connected.mtime, state_connected.netboot 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 ''; + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; echo ''; echo 'ALX Config - Index'; echo '