Changeset 4 for www/finance/strom.php
- Timestamp:
- Jan 14, 2008, 9:48:39 PM (17 years ago)
- Location:
- www
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
www
-
Property svn:ignore
set to
config.php
php_script_error.log
-
Property svn:ignore
set to
-
www/finance/strom.php
r1 r4 1 <? 1 <?php 2 include('../global.php'); 2 3 include('../style.php'); 3 include('../db.php'); 4 DB_Init('localhost','root','','is'); 5 ShowHeader('Zaøízení sítì','Zaøízení'); 4 ShowHeader('Zařízení sítě', 'Zařízení'); 6 5 7 // Seznam segment ù a zaøízení8 echo('Stromový výpis struktury sít ì:<br>');9 DB_Query("SELECT * FROM network_segments WHERE parent = 0");10 $root = DB_Row();6 // Seznam segmentů a zařízení 7 echo('Stromový výpis struktury sítě:<br>'); 8 $DbResult = $Database->query("SELECT * FROM network_segments WHERE parent = 0"); 9 $root = $DbResult->fetch_array(); 11 10 echo '<img src="../images/strom/server.png" width="16" height="16"/> '.$root['name'].'<br/>'; 12 11 $level = 0; … … 14 13 $position = array(0); 15 14 $count = array(0); 16 DB_Query("SELECT * FROM users WHERE network_segment = ".$parent[$level]);17 $count[0] +=DB_NumRows();18 DB_Query("SELECT * FROM network_devices WHERE segment = ".$parent[$level]);19 $count[0] +=DB_NumRows();20 DB_Query("SELECT * FROM network_segments WHERE parent = ".$parent[$level]);21 $count[0] +=DB_NumRows();15 $DbResult = $Database->query("SELECT * FROM users WHERE network_segment = ".$parent[$level]); 16 $count[0] += $DbResult->fetch_array(); 17 $DbResult = $Database->query("SELECT * FROM network_devices WHERE segment = ".$parent[$level]); 18 $count[0] += $DbResult->fetch_array(); 19 $DbResult = $Database->query("SELECT * FROM network_segments WHERE parent = ".$parent[$level]); 20 $count[0] += $DbResult->fetch_array(); 22 21 23 22 24 function showlines($type) { 25 global $count, $position, $level; 23 function showlines($type) 24 { 25 global $count, $position, $level, $Database; 26 26 27 $i = 0; 27 while ($i<$level) { 28 if ($position[$i]<$count[$i]) { 28 while ($i < $level) 29 { 30 if ($position[$i]<$count[$i]) 31 { 29 32 echo '<img src="../images/strom/line.gif" width="16" height="16"/>'; 30 } else { 33 } else 34 { 31 35 echo '<img src="../images/strom/null.gif" width="16" height="16"/>'; 32 36 } 33 37 $i++; 34 38 } 35 if ($type==0) { 36 if ($position[$i]<$count[$i]) { 39 if ($type==0) 40 { 41 if ($position[$i]<$count[$i]) 42 { 37 43 echo '<img src="../images/strom/sub.gif" width="16" height="16"/>'; 38 } else { 44 } else 45 { 39 46 echo '<img src="../images/strom/sub_.gif" width="16" height="16"/>'; 40 47 } 41 } else { 42 if ($position[$i]<$count[$i]) { 48 } else 49 { 50 if ($position[$i]<$count[$i]) 51 { 43 52 echo '<img src="../images/strom/plus.gif" width="16" height="16"/>'; 44 53 } else { … … 49 58 } 50 59 51 do { 52 if ($position[$level]==0) { 53 DB_Query("SELECT * FROM users WHERE network_segment = ".$parent[$level]); 60 do 61 { 62 if ($position[$level]==0) 63 { 64 $DbResult = $Database->query("SELECT * FROM users WHERE network_segment = ".$parent[$level]); 54 65 $devs = 0; 55 while ($item=DB_Row()) { 66 while ($item = $DbResult->fetch_array) 67 { 56 68 $position[$level]++; 57 69 $devs++; … … 62 74 $count[$level] -= $devs; 63 75 } 64 if ($position[$level]==0) { 65 DB_Query("SELECT * FROM network_devices WHERE segment = ".$parent[$level]); 76 if ($position[$level]==0) 77 { 78 $DbResult = $Database->query("SELECT * FROM network_devices WHERE segment = ".$parent[$level]); 66 79 $devs = 0; 67 while ($item=DB_Row()) { 80 while ($item = $DbResult->fetch_array()) 81 { 68 82 $position[$level]++; 69 83 $devs++; 70 if ($item['used']==1) { 84 if ($item['used']==1) 85 { 71 86 showlines(0); 72 87 echo '<img src="../images/strom/device.png" width="16" height="16"/> '.$item['name'].'<br/>'; … … 79 94 $count[$level] -= $devs; 80 95 } 81 if ($position[$level]<$count[$level]) { 82 DB_Query("SELECT * FROM network_segments WHERE parent = ".$parent[$level].' LIMIT '.$position[$level].',1'); 83 $item = DB_Row(); 84 if (!$item) { 85 echo '<br/>Do¹lo k chybì!!</br>'; 96 if ($position[$level]<$count[$level]) 97 { 98 $DbResult = $Database->query("SELECT * FROM network_segments WHERE parent = ".$parent[$level].' LIMIT '.$position[$level].',1'); 99 $item = $DbResult->fetch_array; 100 if (!$item) 101 { 102 echo '<br/>Došlo k chybě!!</br>'; 86 103 break; 87 104 } … … 91 108 $level++; 92 109 $parent[$level]=$item['id']; 93 $position[$level] =0;110 $position[$level] = 0; 94 111 $count[$level] = 0; 95 DB_Query("SELECT * FROM users WHERE network_segment = ".$parent[$level]); 96 $count[$level]+=DB_NumRows(); 97 DB_Query("SELECT * FROM network_devices WHERE segment = ".$parent[$level]); 98 $count[$level]+=DB_NumRows(); 99 DB_Query("SELECT * FROM network_segments WHERE parent = ".$parent[$level]); 100 $count[$level]+=DB_NumRows(); 101 } else { 112 $DbResult = $Database->query("SELECT * FROM users WHERE network_segment = ".$parent[$level]); 113 $count[$level] += $DbResult->fetch_array; 114 $DbResult = $Database->query("SELECT * FROM network_devices WHERE segment = ".$parent[$level]); 115 $count[$level] += $DbResult->fetch_array; 116 $DbResult = $Database->query("SELECT * FROM network_segments WHERE parent = ".$parent[$level]); 117 $count[$level] += $DbResult->fetch_array; 118 } else 119 { 102 120 $level--; 103 121 } 104 } while ($level>=0);122 } while($level >= 0); 105 123 106 124 ShowFooter();
Note:
See TracChangeset
for help on using the changeset viewer.