Legend:
- Unmodified
- Added
- Removed
-
index.php
r1 r3 1 <? 2 include('stat_functions.php'); 3 include('db.php'); 4 DB_Init('localhost', 'stat', '', 'statistic'); 5 DB_Query('SET CHARACTER SET latin2'); 1 <?php 2 include('global.php'); 6 3 7 4 $Debug = 0; … … 100 97 ), 101 98 ); 102 103 session_start();104 99 105 100 $Variables = array( … … 125 120 } 126 121 127 echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 128 <html><head> 129 <meta http-equiv="Content-Language" content="cs"> 130 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> 131 <title>Statistika</title> 132 <LINK REL="StyleSheet" HREF="style.css" TYPE="text/css" MEDIA="all"> 133 </head><body style="font-family: sans-serif;">'); 134 echo('<div class="Title">Statistiky</div>'); 122 123 $Output = '<div class="Title">Statistiky</div>'; 135 124 136 125 if(!array_key_exists('Operation', $_GET)) $_GET['Operation'] = ''; … … 168 157 echo('<br><br>'); 169 158 */ 170 echo('<strong>Èasový úsek:</strong><br>');159 $Output .= '<strong>Èasový úsek:</strong><br>'; 171 160 // Show graf time range menu 172 161 if($_SESSION['TimeSpecify'] == 0) 173 162 { 174 echo('Délka úseku: ');163 $Output .= 'Délka úseku: '; 175 164 foreach($GrafTimeRanges as $Index => $Item) 176 echo('<a href="?Period='.$Index.'">'.$Item['caption'].'</a> ');177 echo('<br>');178 echo('<a href="?TimeSpecify=1">Pøesnìj¹í nastavení...</a><br>');165 $Output .= '<a href="?Period='.$Index.'">'.$Item['caption'].'</a> '; 166 $Output .= '<br>'; 167 $Output .= '<a href="?TimeSpecify=1">Pøesnìj¹í nastavení...</a><br>'; 179 168 } else { 180 echo('<table cellspacing="0" cellpadding="2" border="0">');181 echo('<tr><td>Poèátek:</td><td>'.EditTime('TimeStart').'</td></tr>');182 echo('<tr><td>Konec:</td><td>'.EditTime('TimeEnd').'</td></tr>');183 echo('</table>');184 echo('<a href="?TimeSpecify=0">Jednoduché nastavení...</a><br>');169 $Output .= '<table cellspacing="0" cellpadding="2" border="0">'; 170 $Output .= '<tr><td>Poèátek:</td><td>'.EditTime('TimeStart').'</td></tr>'; 171 $Output .= '<tr><td>Konec:</td><td>'.EditTime('TimeEnd').'</td></tr>'; 172 $Output .= '</table>'; 173 $Output .= '<a href="?TimeSpecify=0">Jednoduché nastavení...</a><br>'; 185 174 } 186 echo('<br>');187 188 echo('<strong>Graf:</strong><br>');189 echo('<img alt="Graf" src="graph.php?Measure='.$_SESSION['Measure'].'&From='.$_SESSION['TimeStart'].'&To='.$_SESSION['TimeEnd'].'&Width=750&Height=200" width="750" height="214"><br>');175 $Output .= '<br>'; 176 177 $Output .= '<strong>Graf:</strong><br>'; 178 $Output .= '<img alt="Graf" src="graph.php?Measure='.$_SESSION['Measure'].'&From='.$_SESSION['TimeStart'].'&To='.$_SESSION['TimeEnd'].'&Width=750&Height=200" width="750" height="214"><br>'; 190 179 //print_r(GetValues($Measure, $TimeStart, $TimeEnd)); 191 180 192 echo('<br>'); 193 194 echo('<table border="1" cellspacing="0" cellpadding="2" style="font-size: small;">'); 195 echo('<tr><th>Mìøená velièina</th><th>Èas posledního mìøení</th><th>Poslední hodnota</th><th>Interpolace</th><th>Poznámky</th></tr>'); 196 DB_Select('stat_measure', '*', 'enabled=1 AND permission_view="all" OR permission_view="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'" ORDER BY description'); 197 while($Measure = DB_Row()) 198 { 199 DB_Save(); 181 $Output .= '<br>'; 182 183 $Output .= '<table border="1" cellspacing="0" cellpadding="2" style="font-size: small;">'; 184 $Output .= '<tr><th>Mìøená velièina</th><th>Èas posledního mìøení</th><th>Poslední hodnota</th><th>Interpolace</th><th>Poznámky</th></tr>'; 185 $Database->select_db('measure'); 186 $Result = $Database->select('measure', '*', 'Enabled=1 AND PermissionView="all" OR PermissionView="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'" ORDER BY Description'); 187 //echo($Database->error); 188 189 while($Measure = $Result->fetch_array()) 190 { 200 191 $StopWatchStart = GetMicrotime(); 201 192 // DB_Select('stat_data', 'COUNT(*)', 'measure='.$Measure['id']); … … 203 194 // $RowCount = $RowCount[0]; 204 195 // $RowCount = 0; 205 DB_Select('stat_data', 'time, avg', 'measure='.$Measure['id'].' ORDER BY time DESC LIMIT 1');206 if( DB_NumRows()> 0)196 $Result2 = $Database->select('stat_data', 'time, avg', 'measure='.$Measure['id'].' ORDER BY time DESC LIMIT 1'); 197 if($Result2->num_rows > 0) 207 198 { 208 $Row = DB_Row();199 $Row = $Result2->fetch_array(); 209 200 $LastMeasureTime = date('j.n.Y G:i:s', MysqlDateTimeToTime($Row['time'])); 210 201 $LastMeasureValue = round($Row['avg'] / $Measure['display_divider']); … … 216 207 if($Measure['info'] == '') $Measure['info'] = ' '; 217 208 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 218 echo('<tr><td><a href="?Measure='.$Measure['id'].'">'.$Measure['description'].'</a></td><td align="center">'.$LastMeasureValue.' '.$Measure['display_unit'].'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['info'].'</td>');209 $Output .= '<tr><td><a href="?Measure='.$Measure['id'].'">'.$Measure['description'].'</a></td><td align="center">'.$LastMeasureValue.' '.$Measure['display_unit'].'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['info'].'</td>'; 219 210 //<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td></tr>'); 220 211 flush(); 221 DB_Load();222 212 } 223 echo('</table>');224 echo('<br><a href="development/">Sekce vývoje systému</a>');213 $Output .= '</table>'; 214 $Output .= '<br><a href="development/">Sekce vývoje systému</a>'; 225 215 //echo(time()); 226 216 //print_r(gd_info()); 227 echo('<br><div style="font-size: small;">Kontakt: robie@centrum.cz</div>');228 echo('</body></html>');217 $Output .= '<br><div style="font-size: small;">Kontakt: robie@centrum.cz</div>'; 218 $Output .= '</body></html>'; 229 219 //print_r($_SESSION); 230 220 221 ShowPage($Output); 231 222 232 223
Note:
See TracChangeset
for help on using the changeset viewer.