--- alx-src/branches/alx-web-070/index.php 2016/02/08 14:05:46 8553 +++ alx-src/branches/alx-web-070/index.php 2019/07/10 08:54:02 13245 @@ -3,11 +3,14 @@ include('include/basesql.php'); include('include/common-functions.php'); -session_start(); +if(session_status() !== PHP_SESSION_ACTIVE) session_start(); //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; +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']; + +// fix reload php debug message +if(!isset($reload)) $reload = 'not set'; $locations = sqlarr('SELECT location FROM client_locations where enabled="1"', '', 'location'); $locations[] = ''; @@ -22,9 +25,17 @@ 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]; + + if(isset($_GET['s_on'])) $_SESSION['alx_sort_onfirst']=0+$_GET['s_on']; + else $_SESSION['alx_sort_onfirst']=0+NULL; + + if(isset($_GET['s_dead'])) $_SESSION['alx_sort_loc']['DEAD']=$_GET['s_dead']; + else $_SESSION['alx_sort_loc']['DEAD']=NULL; + + foreach($locations as $l) { + if(isset($_GET['s_'.$l])) $_SESSION['alx_sort_loc'][$l]=$_GET['s_'.$l]; + else $_SESSION['alx_sort_loc'][$l]=NULL; + } } function check_online($dat, $bla) @@ -53,8 +64,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') { @@ -91,7 +102,7 @@ echo '
'; echo ''; // print version info -$version = file_get_contents('.VERSION', FILE_USE_INCLUDE_PATH); +$version = file_get_contents('./VERSION', FILE_USE_INCLUDE_PATH); echo ''; echo ''; echo ''; @@ -111,16 +122,18 @@ echo '
v'.$version.'[REFRESH]
'; echo ''; -echo ''; +echo ''; echo ''; echo ''; foreach($comps as $c) { - if(!$_SESSION['alx_sort_loc'][$c['location']]) Continue; + $alxinfo = array(); + + if(!isset($_SESSION['alx_sort_loc'][$c['location']])) Continue; if($c['enabled']==0 && !$_SESSION['alx_sort_loc']['DEAD']) Continue; - if($c['online']) $pic='online'; + if(isset($c['online'])) $pic='online'; else $pic='offline'; if($c['enabled']==0) @@ -143,21 +156,24 @@ // get alx version info for $alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$c['serial']); - $alxver = $alxinfo[os]; - $alxutils = $alxinfo[utils]; + if (isset($alxinfo['os'])) $alxver = $alxinfo['os']; + else $alxver = 'unknown'; + if (isset($alxinfo['utils'])) $alxutils = $alxinfo['utils']; + else $alxutils = 'unknown'; - if($alxver == '') $alxver='unknown'; - if($alxutils == '') $alxutils='unknown'; + if (isset($alxinfo['arch'])) $alxarch = $alxinfo['arch']; + else $alxarch = 'unknown'; echo ''; echo ''; + echo ''; // netboot state if($c['netboot'] == 1) echo ''; else echo ''; echo '
editserialhostnameipmaclast connectedversionversionbootup/down
'.$alxver.''.$alxutils.''.$alxarch.'Netboot (PXE)Local Disk'; - if($c['online']) + if(isset($c['online'])) { echo ''; echo '';