Changeset 4 for www/finance/strom.php


Ignore:
Timestamp:
Jan 14, 2008, 9:48:39 PM (17 years ago)
Author:
george
Message:

Upraveno: Změna přístupu k databázi na třídu rozšířenou mysqli.
Upraveno: Sjednocení
Upraveno: Změna kódování všech stránek na UTF-8.
Odstraňeno: Staré nepotřebné soubory.

Location:
www
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • www

    • Property svn:ignore set to
      config.php
      php_script_error.log
  • www/finance/strom.php

    r1 r4  
    1 <?
     1<?php
     2include('../global.php');
    23include('../style.php');
    3 include('../db.php');
    4 DB_Init('localhost','root','','is');
    5 ShowHeader('Zaøízení sítì','Zaøízení');
     4ShowHeader('Zařízení sítě', 'Zařízení');
    65
    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í
     7echo('Stromový výpis struktury sítě:<br>');
     8$DbResult = $Database->query("SELECT * FROM network_segments WHERE parent = 0");
     9$root = $DbResult->fetch_array();
    1110echo '<img src="../images/strom/server.png" width="16" height="16"/>&nbsp;'.$root['name'].'<br/>';
    1211$level = 0;
     
    1413$position = array(0);
    1514$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();
    2221
    2322
    24 function showlines($type) {
    25   global $count, $position, $level;
     23function showlines($type)
     24{
     25  global $count, $position, $level, $Database;
     26 
    2627  $i = 0;
    27   while ($i<$level) {
    28     if ($position[$i]<$count[$i]) {
     28  while ($i < $level)
     29  {
     30    if ($position[$i]<$count[$i])
     31    {
    2932      echo '<img src="../images/strom/line.gif" width="16" height="16"/>';
    30     } else {
     33    } else
     34    {
    3135      echo '<img src="../images/strom/null.gif" width="16" height="16"/>';
    3236    }
    3337    $i++;
    3438  }
    35   if ($type==0) {
    36     if ($position[$i]<$count[$i]) {
     39  if ($type==0)
     40  {
     41    if ($position[$i]<$count[$i])
     42    {
    3743      echo '<img src="../images/strom/sub.gif" width="16" height="16"/>';
    38     } else {
     44    } else
     45    {
    3946      echo '<img src="../images/strom/sub_.gif" width="16" height="16"/>';
    4047    }
    41   } else {
    42     if ($position[$i]<$count[$i]) {
     48  } else
     49  {
     50    if ($position[$i]<$count[$i])
     51    {
    4352      echo '<img src="../images/strom/plus.gif" width="16" height="16"/>';
    4453    } else {
     
    4958}
    5059
    51 do {
    52   if ($position[$level]==0) {
    53     DB_Query("SELECT * FROM users WHERE network_segment = ".$parent[$level]);
     60do
     61{
     62  if ($position[$level]==0)
     63  {
     64    $DbResult = $Database->query("SELECT * FROM users WHERE network_segment = ".$parent[$level]);
    5465    $devs = 0;
    55     while ($item=DB_Row()) {
     66    while ($item = $DbResult->fetch_array)
     67    {
    5668      $position[$level]++;
    5769      $devs++;
     
    6274    $count[$level] -=  $devs;
    6375  }
    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]);
    6679    $devs = 0;
    67     while ($item=DB_Row()) {
     80    while ($item = $DbResult->fetch_array())
     81    {
    6882      $position[$level]++;
    6983      $devs++;
    70       if ($item['used']==1) {
     84      if ($item['used']==1)
     85      {
    7186        showlines(0);
    7287        echo '<img src="../images/strom/device.png" width="16" height="16"/>&nbsp;'.$item['name'].'<br/>';
     
    7994    $count[$level] -=  $devs;
    8095  }
    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>';
    86103      break;
    87104    }
     
    91108    $level++;
    92109    $parent[$level]=$item['id'];
    93     $position[$level]=0;
     110    $position[$level] = 0;
    94111    $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  {
    102120    $level--;
    103121  }
    104 } while ($level>=0);
     122} while($level >= 0);
    105123
    106124ShowFooter();
Note: See TracChangeset for help on using the changeset viewer.