Changeset 129 for www


Ignore:
Timestamp:
Jan 5, 2009, 7:31:45 AM (16 years ago)
Author:
george
Message:
  • Odstraněno: Openwebmail. * Odstraněno: phpMyAdmin. * Upraveno: Mnoho malých úprav a oprav.
Location:
www
Files:
2 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • www/aktuality/rss.php

    r4 r129  
    2121  foreach($Parts as $Part)
    2222  {
    23     $Where .= 'OR (category='.($Part * 1).')'; 
     23    $Where .= 'OR (category='.($Part * 1).')';
    2424  }
    2525  $Where = substr($Where, 2);
     
    3535
    3636// Update news from discussion forum
    37 $ForumCategory = 4;   
     37$ForumCategory = 4;
    3838$Database->select_db('forum');
    3939$DbResult = $Database->query('SELECT posts.post_time, posts_text.post_subject, posts_text.post_text, users.username, topics.topic_title FROM posts JOIN posts_text ON posts.post_id = posts_text.post_id JOIN users ON users.user_id = posts.poster_id JOIN topics ON topics.topic_id= posts.topic_id ORDER BY post_time DESC LIMIT '.$NewsCount);
     40
    4041$Index = 0;
    4142//echo(DB_NumRows().',');
    4243while($Row = $DbResult->fetch_array())
    4344{
    44   $Row['post_text'] = StrTr($Row['post_text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 
    45   $Row['post_text'] = str_replace("\n","<br>", $Row['post_text']); 
    46   $Row['post_subject'] = StrTr($Row['post_subject'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 
    47   $Row['topic_title'] = StrTr($Row['topic_title'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE"); 
    48   $Index = $Index + 1;   
    49  
     45  $Row['post_text'] = StrTr($Row['post_text'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
     46  $Row['post_text'] = str_replace("\n","<br>", $Row['post_text']);
     47  $Row['post_subject'] = StrTr($Row['post_subject'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
     48  $Row['topic_title'] = StrTr($Row['topic_title'], "\x8A\x8D\x8E\x9A\x9D\x9E", "\xA9\xAB\xAE\xB9\xBB\xBE");
     49  $Index = $Index + 1;
     50
    5051  $Title = $Row['topic_title'].'-'.$Row['post_subject'];
    5152  $Content = $Row['post_text'];
  • www/aktuality/rss_generator.php

    r4 r129  
    66{
    77  global $Config;
    8  
     8
    99  $Result = '<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'" ?>'."\n". //<?
    1010  '<rss version="2.0">'."\n".
     
    1515  "    <language>cs</language>\n".
    1616  "    <webMaster>".$Data['WebmasterEmail']."</webMaster>\n".
    17   "    <pubDate>".date('r')."</pubDate>\n". 
     17  "    <pubDate>".date('r')."</pubDate>\n".
    1818  "    <ttl>20</ttl>\n";
    1919  foreach($Data['Items'] as $Item)
     
    2222    '      <title>'.htmlspecialchars($Item['Title'])."</title>\n".
    2323    '      <description>'.htmlspecialchars($Item['Description'])."</description>\n".
    24           '      <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".
    25           '      <link>'.$Item['Link']."</link>\n".
     24    '      <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".
     25    '      <link>'.$Item['Link']."</link>\n".
    2626    "    </item>\n";
    2727  }
  • www/database.php

    r67 r129  
    7373  function charset($Charset)
    7474  {
    75     $this->LastQuery = 'SET CHARACTER SET '.$Charset;
     75    $this->LastQuery = "SET NAMES '".$Charset."'";
    7676    $this->query($this->LastQuery);
    7777  }
  • www/finance/bills.php

    r79 r129  
    8383    global $Database;
    8484 
    85     $Database->insert('finance_bills', array('time_create' => TimeToMysqlDateTime($TimeFrom), 'user_id' => $UserId, 'time_from' => TimeToMysqlDateTime($TimeFrom), 'time_to' => TimeToMysqlDateTime($TimeTo), 'time_due' => TimeToMysqlDateTime($TimeFrom + 15*24*3600)));
     85    $Database->insert('finance_bills', array('time_create' => TimeToMysqlDateTime(time()), 'user_id' => $UserId, 'time_from' => TimeToMysqlDateTime($TimeFrom), 'time_to' => TimeToMysqlDateTime($TimeTo), 'time_due' => TimeToMysqlDateTime($TimeFrom + 15*24*3600)));
    8686    $BillId = $Database->insert_id;
    8787    foreach($Items as $Item)
  • www/finance/monthly_overall.php

    r66 r129  
    55ShowHeader('Měsíční přehledy', 'Měsíční přehledy');
    66
    7 echo('<table cellspacing="0" cellpadding="2" border="1"><tr><th>Rok</th><th>Měsíc</th><th>Internet [Kč]</th><th>Účastníků</th><th>Správa [Kč/účastníka]</th><th>Správa [Kč]</th><th>Spotřeba [Kč/kWh]</th><th>Spotřeba [Kč]</th><th>Obrat [Kč]</th><th>Průměrná cena [Kč/účastníka]</th></tr>');
    8 $Total = array('money' => 0, 'administration_total' => 0, 'consumption_total' => 0, 'total_paid' => 0);
    9 $DbResult = $Database->select('finance_monthly_overall', '*', '1 ORDER BY date DESC');
     7echo('<table cellspacing="0" cellpadding="2" border="1"><tr><th>Rok</th><th>Měsíc</th><th>Internet [Kč]</th><th>Účastníků</th><th>Správa [Kč/účastníka]</th><th>Správa [Kč]</th><th>Spotřeba [Kč/kWh]</th><th>Spotřeba [Kč]</th><th>Obrat [Kč]</th><th>Průměrná cena [Kč/účastníka]</th><th>Investice [Kč]</th></tr>');
     8$Total = array('money' => 0, 'administration_total' => 0, 'consumption_total' => 0, 'total_paid' => 0, 'investment' => 0);
     9$DbResult = $Database->select('finance_monthly_overall', '*', '1 ORDER BY date ASC');
    1010while($Month = $DbResult->fetch_array())
    1111{
    1212  $DateParts = explode('-', $Month['date']);
    13   echo('<tr><td>'.$DateParts[0].'</td><td align="center">'.$MonthNames[$DateParts[1]*1].'</td><td align="center">'.$Month['money'].'</td><td align="center">'.$Month['member_count'].'</td><td align="center">'.$Month['administration'].'</td><td align="center">'.$Month['administration_total'].'</td><td align="center">'.$Month['kWh'].'</td><td align="center">'.$Month['consumption_total'].'</td><td align="center">'.$Month['total_paid'].'</td><td align="center">'.round($Month['total_paid'] / $Month['member_count']).'</td></tr>');
     13  echo('<tr><td>'.$DateParts[0].'</td><td align="center">'.$MonthNames[$DateParts[1]*1].'</td><td align="center">'.$Month['money'].'</td><td align="center">'.$Month['member_count'].'</td><td align="center">'.$Month['administration'].'</td><td align="center">'.$Month['administration_total'].'</td><td align="center">'.$Month['kWh'].'</td><td align="center">'.$Month['consumption_total'].'</td><td align="center">'.$Month['total_paid'].'</td><td align="center">'.round($Month['total_paid'] / $Month['member_count']).'</td><td align="center">'.$Month['investment'].'</td></tr>');
     14//  echo('<tr><td>'.$Month['date'].'</td><td align="center">'.$MonthNames[$DateParts[1]*1].'</td><td align="center">'.$Month['money'].'</td><td align="center">'.$Month['member_count'].'</td><td align="center">'.$Month['administration'].'</td><td align="center">'.$Month['administration_total'].'</td><td align="center">'.$Month['kWh'].'</td><td align="center">'.$Month['consumption_total'].'</td><td align="center">'.$Month['total_paid'].'</td><td align="center">'.round($Month['total_paid'] / $Month['member_count']).'</td></tr>');
    1415
    1516  $Total['money'] += $Month['money'];
     
    1718  $Total['consumption_total'] += $Month['consumption_total'];
    1819  $Total['total_paid'] += $Month['total_paid'];
     20  $Total['investment'] += $Month['investment'];
    1921  //if($DateParts[1] == '01') echo('<tr><td style="font-size: 4;" colspan="10">&nbsp;</td></tr>');
    2022}
    21 echo('<tr><th colspan="2">Celkem</th><th>'.$Total['money'].'</th><th>&nbsp;</th><th>&nbsp;</th><th>'.$Total['administration_total'].'</th><th>&nbsp;</th><th>'.$Total['consumption_total'].'</th><th>'.$Total['total_paid'].'</th><th>&nbsp;</th>');
     23echo('<tr><th colspan="2">Celkem</th><th>'.$Total['money'].'</th><th>&nbsp;</th><th>&nbsp;</th><th>'.$Total['administration_total'].'</th><th>&nbsp;</th><th>'.$Total['consumption_total'].'</th><th>'.$Total['total_paid'].'</th><th>&nbsp;</th><th>'.$Total['investment'].'</tr>');
    2224echo('</table>');
    2325
  • www/finance/prepocet.php

    r55 r129  
    164164  echo("Odečítám měsíční poplatek...<br>\n");
    165165
     166  $BillingPeriodMonthCount = array('never' => 0, 'monthly' => 1, 'quarterly' => 3, 'half-yearly' => 6, 'yearly' => 12);
     167
    166168  // Generuj účetní položky
    167   $DbResult = $Database->query("SELECT *,CONCAT(second_name, ' ', first_name) as fullname FROM users WHERE role=2");
    168   while($Row = $DbResult->fetch_array())
    169   {
    170     echo($Row['fullname'].': '.($Row['plus'] - $Row['monthly'])."<br>\n");
    171 
    172     $BillId = $InvoiceGenerator->CreateBill($Row['id'], array(array('description' => 'Poplatek za připojení k síti', 'price' => ($Row['monthly'] - $Row['plus']), 'quantity' => 1)), time(), time() + (date("t", time()) - 1) * 24 * 3600);
    173 
    174     $Database->insert('finance_operations',array('money' => ($Row['plus'] - $Row['monthly']), 'user' => $Row['id'], 'type' => 2, 'date' => 'NOW()', 'comment' => 'Poplatek za měsíc '.$Mesice[$Mesic], 'group' => 1, 'bill_id' => $BillId));
    175   }
    176 
     169  $DbResult = $Database->query("SELECT *, CONCAT(second_name, ' ', first_name) as fullname FROM users WHERE (role = 2)");
     170  while($User = $DbResult->fetch_array())
     171  {
     172    echo($User['fullname'].': ');
     173    $MonthCount = $BillingPeriodMonthCount[$User['BillingPeriod']];
     174    if(($MonthCount > 0) and (((($Mesic - 1) % 12) % $MonthCount) == 0) and ($User['inet_tarif_now'] != 6))
     175    {
     176      //echo($Mesic.'%'.$MonthCount.'='.($Mesic % $MonthCount).' ');
     177      $PayPerMonth = -($User['plus'] - $User['monthly']);
     178      $PayPerPeriod = $PayPerMonth * $MonthCount;
     179      $PeriodFrom = mktime(0, 0, 0, date('n'), 1, date('Y'));
     180      $PeriodTo = mktime(0, 0, 0, date('n') + $MonthCount - 1, date('t', mktime(0, 0, 0, date('n') + $MonthCount - 1, 1, date('Y'))) , date('Y'));
     181      $TimePeriodText = date('j.n.Y', $PeriodFrom).' - '.date('j.n.Y', $PeriodTo);
     182      echo($TimePeriodText.': '.$PayPerMonth." * ".$MonthCount." = ".$PayPerPeriod."\n");
     183      $BillId = $InvoiceGenerator->CreateBill($User['id'], array(array('description' => 'Připojení k síti', 'price' => $PayPerPeriod, 'quantity' => 1)), $PeriodFrom, $PeriodTo);
     184      $Database->insert('finance_operations', array('money' => -$PayPerPeriod, 'user' => $User['id'], 'type' => 2, 'date' => 'NOW()', 'comment' => 'Připojení k síti za období '.$TimePeriodText, 'group' => 1, 'bill_id' => $BillId));
     185    } else echo("\n");
     186  }
    177187  echo('Měním aktuální parametry sítě...<br>\n');
    178188
     
    184194  $DbResult = $Database->insert('finance_charge', array('period' => 0, 'internet' => $Charge['internet'],
    185195    'internet_speed' => $Charge['internet_speed'], 'internet_speed_reserve' => $Charge['internet_speed_reserve'], 'administration_per_user' => $Charge['administration_per_user'], 'kWh' => $Charge['kWh'], 'base_speed_element' => $Charge['base_speed_element'], 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice']));
    186  
     196
    187197  echo("Přidávám měsíční přehled...<br>\n");
    188198
    189   $Database->insert('finance_monthly_overall', array('date' => 'NOW()', 'money' => $Internet, 'kWh' => $kWh, 'administration' => $Sprava, 'administration_total' => $SpravaCelkem, 'consumption_total' => $CelkemSpotreba, 'total_paid' => $TotalPaid, 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice']));
    190  
     199  $Database->insert('finance_monthly_overall', array('date' => 'NOW()', 'money' => $Internet, 'kWh' => $kWh, 'administration' => $Sprava, 'administration_total' => $SpravaCelkem, 'consumption_total' => $CelkemSpotreba, 'total_paid' => $TotalPaid, 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice'], 'member_count' => $InternetUsers));
     200
    191201  echo("Měním aktuální tarify....<br>\n");
    192202
     
    199209      'speed_factor' => $Tariff['speed_factor'], 'price_units' => $Tariff['price_units'], 'group_id' => $Tariff['group_id'], 'min_speed' => $Tariff['min_speed'], 'max_speed' => $Tariff['max_speed'], 'price' => $Tariff['price']));
    200210  }
    201  
     211
    202212  echo("Měním aktuální tarify uživatelů...<br>\n");
    203213
     
    211221  RecalculateTariffs();
    212222  RecalculateUsersFinance();
    213   CreateMonthlyOverallBill();
     223  //CreateMonthlyOverallBill();
    214224  RecalculateUsersFinance();
    215  
     225
    216226  // Restart traffic shaping
    217227  $Database->update('services_restart', 'id=3', array('changed' => 1));
  • www/index.php

    r114 r129  
    174174while($Row = $DbResult->fetch_array())
    175175{
    176   echo($Row['name'].'<br />');
     176  echo(strtoupper($Row['name']).'<br>');
    177177}
    178178echo('</span>');
  • www/is/tc.php

    r1 r129  
    66    <title>Traffic Control stat</title>
    77    <meta http-equiv="Content-Language" content="cs">
    8     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
     8    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    99<style type="text/css">
    1010table td
     
    121121  {
    122122    global $ClassList;
     123
    123124    if(array_key_exists('Leaf', $Class)) $Class['Id'] .= ' Leaf';
    124125    if(!array_key_exists('Prio', $Class)) $Class['Prio'] = '&nbsp;';
     
    136137      foreach($Class['SubClasses'] as $Index => $SubClassId)
    137138        ShowClass($ClassList[$SubClassId], $Level + 1);
    138       //echo('</table></td></tr>');   
     139      //echo('</table></td></tr>');
    139140    }
    140141  }
    141142
    142   echo('<table style="font-size: small;" border="0" cellspacing="0" cellpadding="1"><tr><th>Id</th><th>Level</th><th>Description</th><th>Prio</th>
     143  echo('<table style="font-size: x-small;" border="0" cellspacing="0" cellpadding="1"><tr><th>Id</th><th>Level</th><th>Description</th><th>Prio</th>
    143144  <th>Rate [bit/s]</th><th>Ceil [bit/s]</th><th>Burst [B/s]</th><th>CBurs [B/s]t</th><th>Quantum [B]</th>
    144145  <th>CurrentRate [bit/s]</th><th>Dropped</th></tr>');
  • www/is/topologie-img.php

    r16 r129  
    55if(array_key_exists('debug', $_GET)) $debug = $_GET['debug'];
    66else $debug = 0;
    7 $TopHostName = 'NIX-ROUTER';
     7$TopHostName = 'nix-router';
    88// $debug = 0;
    99
     
    179179$im_dev = imagecreatefrompng('images/device.png');
    180180// === Generování obrázku ======================================================
    181 $im = imagecreate(($width + 1.6) * $spacex, ($height + 1) * $spacey);
     181$im = imagecreate(($datawidth+$width+3.2) * $halfx, ($height + 1) * $spacey);
    182182$background_color = imagecolorallocate($im, 255, 255, 255);
    183183$black = imagecolorallocate($im, 0, 0, 0);
     
    236236//    imagerectangle($im,xpos($id)+$halfx-6,$vtop[$id]*$spacey+16,xpos($id)+$halfx+6,$vtop[$id]*$spacey+28,$color);
    237237    if ($debug) {
    238       imagestring($im,2,xpos($id)+($spacex-strlen($item['id'])*imagefontwidth(2))/2,$vtop[$id]*$spacey+31+imagefontheight(2),$item['id'],$color);
    239     } else imagestring($im,2,xpos($id)+($spacex-strlen($item['name'])*imagefontwidth(2))/2,$vtop[$id]*$spacey+31+imagefontheight(2),$item['name'],$color);
    240   }   
     238      imagestring($im, 2, xpos($id) + ($spacex - strlen($item['id']) * imagefontwidth(2)) / 2, $vtop[$id] * $spacey + 31 + imagefontheight(2), $item['id'], $color);
     239    } else imagestring($im, 2, xpos($id) + ($spacex - strlen($item['name']) * imagefontwidth(2)) / 2, $vtop[$id] * $spacey + 31 + imagefontheight(2), strtoupper($item['name']), $color);
     240  }
    241241}
    242242
  • www/share/browse.php

    r40 r129  
    11<?php
    22include('../style.php');
     3$SambaBinDir = '/usr/bin/';
     4$SambaSbinDir = '/usr/sbin/';
    35$Database->select_db('share');
    46$ZanoreniMax = 8;                  // Maximální úroven zanoreni
     
    1820echo("Nacitam seznam sdileni pro ".$Host.'('.$HostID.')...');
    1921$Output = array();
    20 exec('smbclient -d0 -N -L='.$Host,$Output);
     22exec($SambaBinDir.'smbclient -d0 -N -L='.$Host,$Output);
    2123echo("OK\n");
    2224//print_r($Output);
     
    158160  echo("Načítám strom sdílení ".$Share."...");
    159161  unset($Output);
    160   passthru("mount.cifs '".$ShareFull."' ".$MountDir.' -o guest,codepage=cp852,iocharset=iso8859-2');
    161   PassThru('ls -A -R -X -l --time-style=+"%Y-%m-%d %I:%M:%S" '.$MountDir.'>'.$TempDir.$Host.'.list 2>'.$TempDir.'errors/'.$Host.'_'.$Share.'.err',$Result);
     162  passthru($SambaSbinDir."mount.cifs '".$ShareFull."' ".$MountDir.' -o guest codepage=cp852 iocharset=iso8859-2');
     163//  echo($SambaSbinDir."mount.cifs '".$ShareFull."' ".$MountDir.' -o guest,codepage=cp852,iocharset=iso8859-2');
     164  passthru('ls -A -R -X -l --time-style=+"%Y-%m-%d %I:%M:%S" '.$MountDir.'>'.$TempDir.$Host.'.list 2>'.$TempDir.'errors/'.$Host.'_'.$Share.'.err',$Result);
    162165  //if($Result==0)
    163166  //{
     
    182185      $Soubor = fopen($TempDir.$Host.'.list','r');
    183186      $Citac = 0;
    184       Vetev('/',0);             // Skenuj sdileni
     187      Vetev('/', 0);            // Skenuj sdileni
    185188      fclose($Soubor);                  // Uzavřít soubor
    186189      unlink($TempDir.$Host.'.list');           // Smazat soubor stromu adresářové struktury
  • www/share/update.sh

    r1 r129  
    11#!/bin/bash
    2 php -c php.ini -f update.php
     2php -f update.php
  • www/statistic/bandwidth.php

    r4 r129  
    4141    if($Host['vpn'] == 1) $Host['IP'] = ToVpnIp($Host);
    4242   
    43     $Host['traffic_down'] = $HostsStat[$Host['IP']]['traffic_avg_down'];
    44     $Host['traffic_up'] = $HostsStat[$Host['IP']]['traffic_avg_up'];
     43    if(array_key_exists($Host['IP'], $HostsStat))
     44    {
     45      $Host['traffic_down'] = $HostsStat[$Host['IP']]['traffic_avg_down'];
     46      $Host['traffic_up'] = $HostsStat[$Host['IP']]['traffic_avg_up'];
     47    } else
     48    {
     49      $Host['traffic_down'] = 0;
     50      $Host['traffic_up'] = 0;
     51    }
    4552     
    4653    if($Host['name'] == 'CENTRALA') $Host['IP'] = $Host['external_ip'];
  • www/statistic/graf2.php

    r4 r129  
    6868  $Krok = $Sirka/$Pocet;
    6969}
    70 
    7170//echo('Maximum...<br>');
    7271//flush();
     
    8786$Max = 0;
    8887$Min = 10000000000000000;
    89  
     88
    9089for($I=0; $I<$Pocet; $I++)
    9190{
     
    9493  //echo('SELECT AVG('.$type.'),MAX('.$type.') FROM traffic WHERE time>FROM_UNIXTIME('.$StartTime.') AND time<FROM_UNIXTIME('.$EndTime.')');
    9594  $DbResult = $Database->query('SELECT AVG('.$type.'),MAX('.$type.') FROM traffic WHERE time>FROM_UNIXTIME('.$StartTime.') AND time<FROM_UNIXTIME('.$EndTime.')');
     95//  echo($Database->error);
    9696  //if($DbResult->num_rows > 0)
    9797  //{
     
    132132// Ramecek
    133133imagerectangle($im,0,0,$Sirka-1,$Vyska-1,$black);
    134 
    135134foreach($BodyMAX as $Index => $Item)
    136135{
  • www/statistic/index.php

    r1 r129  
    1 <?
    2 session_start();
    3 include_once('../style.php');
    4 //$refresh = 60;
    5 ShowHeader('Èasové záznamy','Statistika');
    6 include_once('../is/db.php');
    7 DB_Init('localhost','root','','statistic');
    8 
    9 // Preload measure table
    10 DB_Select('stat_measure', '*');
    11 while($Row = DB_Row()) $Measures[$Row['name']] = $Row;
    12 
    13 $GrafTimeRanges = array(
    14   'hour' => array(
    15     'caption' => 'Hodina',
    16     'seconds' => 60*60,
    17   ),
    18   'day' => array(
    19     'caption' => 'Den',
    20     'seconds' => 24*60*60,
    21   ),
    22   'week' => array(
    23     'caption' => 'Týden',
    24     'seconds' => 7*24*60*60,
    25   ),
    26   'month' => array(
    27     'caption' => 'Mìsíc',
    28     'seconds' => 30*24*60*60,
    29   ),
    30   'year' => array(
    31     'caption' => 'Rok',
    32     'seconds' => 12*30*24*60*60,
    33   ),
    34   'years' => array(
    35     'caption' => 'Roky',
    36     'seconds' => 3*12*30*24*60*60,
    37   ),
    38 );
    39 
    40 $Perioda = 'day';
    41 if(array_key_exists('period',$_SESSION)) $Perioda = $_SESSION['period'];
    42 if(array_key_exists('period',$_GET)) $Perioda = $_GET['period'];
    43 if(!array_key_exists($Perioda, $GrafTimeRanges)) $Perioda = 'day';
    44 $_SESSION['period'] = $Perioda;
    45 
    46 $MeasureName = 'inet';
    47 if(array_key_exists('measure', $_SESSION)) $MeasureName = $_SESSION['measure'];
    48 if(array_key_exists('measure', $_GET)) $MeasureName = $_GET['measure'];
    49 if(!array_key_exists($MeasureName, $Measures)) $MeasureName = 'inet_down';
    50 $_SESSION['measure'] = $MeasureName;
    51 
    52 // Show graf time range menu
    53 echo('Èasový úsek: ');
    54 foreach($GrafTimeRanges as $Index => $Item)
    55   echo('<a href="?period='.$Index.'">'.$Item['caption'].'</a>&nbsp;');
    56 
    57 // Show graf type menu
    58 echo('<br>Výbìr záznamu: ');
    59 foreach($Measures as $Item)
    60   echo('<a href="?measure='.$Item['name'].'">'.$Item['description'].'</a>&nbsp;');
    61 
    62 // Insert graf
    63 echo('<br><br>'.$Measures[$MeasureName]['description'].' za poslední '.strtolower($GrafTimeRanges[$Perioda]['caption']).':<br>');
    64 echo('<img alt="Graf '.strtolower($Measures[$MeasureName]['description']).' za poslední '.strtolower($GrafTimeRanges[$Perioda]['caption']).'"'.
    65   'src="graph.php?measure='.$Measures[$MeasureName]['name'].'&amp;from='.(time() - $GrafTimeRanges[$Perioda]['seconds']).'&amp;to='.time().'" width="750" height="214"><br>');
    66 
    67 echo('<span style="color: #ffb4b4">Maximálnì</span>&nbsp;&nbsp;');
    68 echo('<span style="color: #7878ff">Prùmìrnì</span>');
    69 echo('<br><br>');
    70 
    71 flush();
    72 // Online status check
    73 if(($MeasureName == 'inet') or ($MeasureName == 'inet_down') or ($MeasureName == 'inet_up'))
    74 {
    75   echo('Stav: ');
    76   $Output = array();
    77   $Online = 0;
    78   exec('ping 195.47.235.3 -c 1 | grep received', $Output);
    79   if(count($Output) == 1)
    80   {
    81     $Output = explode(" ",$Output[0]);
    82     if($Output[3]=='1') $Online = 1;
    83   }
    84   // exec('ifconfig | grep ppp0',$Output);
    85   //$Online = count($Output);
    86   if($Online == 1) echo('<font style="color: green; font-weight: bold;">ONLINE</font>'); else echo('<font style="color: red; font-weight: bold;">OFFLINE</font>');
    87  
    88   echo('<br>');
    89  
    90   $EndTime = time();
    91   $StartTime = $EndTime - $GrafTimeRanges[$Perioda]['seconds'];
    92   DB_Select('traffic', 'sum(inet_down),sum(inet_up)', 'time>FROM_UNIXTIME('.$StartTime.') AND time<FROM_UNIXTIME('.$EndTime.')');
    93   $Row = DB_Row();
    94   echo('Za úsek sta¾eno: '.Round($Row[0]*60/1024/1024).' MB &nbsp;&nbsp;&nbsp; Za úsek odesláno: '.Round($Row[1]*60/1024/1024).' MB<br>');
    95 
    96   // Total downloaded and uploaded
    97   DB_Query('select sum(inet_down),sum(inet_up) from traffic');
    98   $Row = DB_Row();
    99   echo('Celkem sta¾eno: '.Round($Row[0]*60/1024/1024).' MB &nbsp;&nbsp;&nbsp; Celkem odesláno: '.Round($Row[1]*60/1024/1024).' MB<br><br>');
    100   echo('<a href="bandwidth.php">Tabulka zatí¾ení linky podle poèítaèù</a><br>');
    101   echo('<a href="http://rychlost.cz/statistika/ip/">Mìøení rychlost pøipojení k internetu (rychlost.cz)</a><br>');
    102  
    103 }
    104 /*
    105 echo('Zatí¾ení internetu za posledních den<br>');
    106 echo('<img align="center" src="graf2.php?count=1440&size=60" width="100%" height="198"><br><br>');
    107 */
    108 
    109 //echo('Zatí¾ení internetu za poslední mìsíc<br>');
    110 //echo('<img align="center" src="graf.php?krok=9000" width="901" height="198"><br><br>');
    111 
    112 // Výpis selhání
    113 /*
    114 echo('<strong>15 posledních zachycených selhání:</strong><br>');
    115 echo('<table border="1" cellspacing="0" cellpadding="1"><tr><th>Èas</th><th>Pokus</th></tr>');
    116 DB_Query('select * from failure order by time desc limit 0,15');
    117 while($Row = DB_Row())
    118 {
    119   echo('<tr><td>'.$Row['time'].'</td><td>'.($Row['attempt']+1).'</td></tr>');
    120 }
    121 echo('</table><i>Poznámka: vytoèeno na první(1), druhý(2), tøetí(3) pokus, jinak restart(4)</i>');
    122 
    123 // echo('informace jsou aktualizovány ka¾dou minutu. stránku je nutno obnovovat.');
    124 */
    125 ShowFooter();
     1<?php
    1262?>
Note: See TracChangeset for help on using the changeset viewer.