Magellan Linux

Diff of /alx-src/tags/alx-web-0_7_0_20171218_1/index.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

alx-src/branches/alx-web-060/index.php revision 2414 by niro, Wed Jun 15 13:12:48 2011 UTC alx-src/branches/alx-web-070/index.php revision 7090 by niro, Wed Sep 9 07:51:52 2015 UTC
# Line 1  Line 1 
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    $_SESSION['alx_sort_krit'] = $alx_sort_krit;
9    $_SESSION['alx_sort_onfirst'] = $alx_sort_onfirst;
10    $_SESSION['alx_sort_loc'] = $alx_sort_loc;
11    
12  $locations = sqlarr('SELECT location FROM client_locations', '', 'location');  $locations = sqlarr('SELECT location FROM client_locations', '', 'location');
13  $locations[] = '';  $locations[] = '';
# Line 66  function checkif($b) Line 71  function checkif($b)
71  }  }
72    
73  $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");
74    
75  sqlforeach('SELECT serial, ip, hostname, mac FROM state_connected', 'check_online', null);  sqlforeach('SELECT serial, ip, hostname, mac FROM state_connected', 'check_online', null);
76  usort($comps, 'sortcomp');  usort($comps, 'sortcomp');
77  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
# Line 112  echo '</form>'; Line 117  echo '</form>';
117    
118  echo '<table border="1" id="mytab">';  echo '<table border="1" id="mytab">';
119  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>';
120    //always enable showversion atm
121    $showversion = "on";
122  if($showversion=='on') echo '<th colspan=2>version</th>';  if($showversion=='on') echo '<th colspan=2>version</th>';
123  echo '<th width=150>up/down</th></tr></thead><tbody>';  echo '<th width=150>up/down</th></tr></thead><tbody>';
124    
# Line 131  foreach($comps as $c) Line 138  foreach($comps as $c)
138   else echo '<tr>';   else echo '<tr>';
139    
140   echo '<td><input type=button value="EDIT" onclick="location.href=\'show.php?id='.$c['serial'].'\'"></td>';   echo '<td><input type=button value="EDIT" onclick="location.href=\'show.php?id='.$c['serial'].'\'"></td>';
141   echo '<td>'.substr($c['location'],0,1).'</td>';   echo '<td>'.substr($c['location'],0,3).'</td>';
142   echo '<td><img src="pics/'.$pic.'.gif" alt="'.strtoupper($pic).'"></td>';   echo '<td><img src="pics/'.$pic.'.gif" alt="'.strtoupper($pic).'"></td>';
143   echo '<td width=40><b>#'.$c['serial'].'</b></td>';   echo '<td width=40><b>#'.$c['serial'].'</b></td>';
144   echo '<td><nobr>'.$c['hostname'].'</nobr></td>';   echo '<td><nobr>'.$c['hostname'].'</nobr></td>';
# Line 141  foreach($comps as $c) Line 148  foreach($comps as $c)
148   //if($c['mtime']) { echo '<td><nobr>'.$c['mtime'].'</nobr></td>'; }   //if($c['mtime']) { echo '<td><nobr>'.$c['mtime'].'</nobr></td>'; }
149   else echo '<td></td>';   else echo '<td></td>';
150    
151   if($c['online'])   if($showversion=='on')
152   {   {
153   if($showversion=='on')   // get alx version info for
154     $alxinfo = sqlfirst('SELECT * FROM client_version WHERE serial='.$c['serial']);
155     $alxver = $alxinfo[os];
156     $alxutils = $alxinfo[utils];
157    
158     if( $alxver == '')
159   {   {
160   $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'])
161   $osver = explode(':',$osver[1]);   {
162   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']);
163   if($osver[1] == '') $osver[1]='unkown';   //$alxinfo = explode(':',$alxinfo[1]);
164           echo '<td>'.$osver[0].'</td>';   //$alxver = $alxinfo[0];
165           echo '<td>'.$osver[1].'</td>';   //$alxutils = $alxinfo[1];
166          }   }
167     }
168     if($alxver == '') $alxver='unknown';
169     if($alxutils == '') $alxutils='unknown';
170    
171           echo '<td>'.$alxver.'</td>';
172           echo '<td>'.$alxutils.'</td>';
173   }   }
174    
175   echo '<td>';   echo '<td>';

Legend:
Removed from v.2414  
changed lines
  Added in v.7090