false); foreach($locations as $l) $_SESSION['alx_sort_loc'][$l]=true; } if(isset($_GET['s_krit'])) { $_SESSION['alx_sort_krit']=$_GET['s_krit']; $_SESSION['alx_sort_onfirst']=0+$_GET['s_on']; $_SESSION['alx_sort_loc']['DEAD']=$_GET['s_dead']; foreach($locations as $l) $_SESSION['alx_sort_loc'][$l]=$_GET['s_'.$l]; } function check_online($dat, $bla) { global $comps; global $mcore_port; global $ping_timeout; if(!isset($comps[$dat['serial']])) return false; $retval = ping_host($dat['ip'],$mcore_port,$ping_timeout); if($retval==0) { $comps[$dat['serial']]['online'] = true; $comps[$dat['serial']]['ip'] = $dat['ip']; } else $comps[$dat['serial']]['ip'] = ''.$dat['ip'].' (no ping)'; $comps[$dat['serial']]['hostname'] = $dat['hostname']; $comps[$dat['serial']]['mac'] = $dat['mac']; } function sortcomp($a,$b) { if($a['serial']<0 && $b['serial']>0) return -1; if($a['serial']>0 && $b['serial']<0) return 1; if($_SESSION['alx_sort_onfirst']) { if($a['online'] && !$b['online']) return -1; if($b['online'] && !$a['online']) return 1; } if($_SESSION['alx_sort_krit']=='hostname') { if(strtoupper($a['hostname'])strtoupper($b['hostname'])) return 1; } return $a['serial']-$b['serial']; } function checkif($b) { if($b) return ' checked'; else return ''; } $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 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 ''; echo ''; echo 'ALX Config - Index'; echo ''; echo ''; echo ''; echo ''; //echo ''; if($reload!='off') echo ''; echo '
'; echo ''; // print version info $version = file_get_contents('.VERSION', FILE_USE_INCLUDE_PATH); echo ''; echo ''; echo ''; echo ''; echo ''; echo '
v'.$version.'[REFRESH]
SORT BY serial hostname
'; echo 'online clients on top
'; foreach($locations as $l) echo ''.($l=='' ? '?' : $l).''; echo '
'; echo 'DEACTIVATED'; echo '

'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; foreach($comps as $c) { if(!$_SESSION['alx_sort_loc'][$c['location']]) Continue; if($c['enabled']==0 && !$_SESSION['alx_sort_loc']['DEAD']) Continue; if($c['online']) $pic='online'; else $pic='offline'; if($c['enabled']==0) { echo ''; $pic = 'deact'; } else echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if($c['mtime']) { echo ''; } else echo ''; // get alx version info for $alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$c['serial']); $alxver = $alxinfo[os]; $alxutils = $alxinfo[utils]; if($alxver == '') $alxver='unknown'; if($alxutils == '') $alxutils='unknown'; echo ''; echo ''; // netboot state if($c['netboot'] == 1) echo ''; else echo ''; echo ''; echo ''; } echo '
editserialhostnameipmaclast connectedversionbootup/down
'.substr($c['location'],0,3).''.strtoupper($pic).'#'.$c['serial'].''.$c['hostname'].''.$c['ip'].''.$c['mac'].''.date('Y-m-d, H:i:s',$c['mtime']).''.$alxver.''.$alxutils.'Netboot (PXE)Local Disk'; if($c['online']) { echo ''; echo ''; echo ''; echo ''; } else echo ''; echo '

'; echo ''; ?>