Changeset 3
- Timestamp:
- Oct 13, 2007, 5:41:26 PM (17 years ago)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
add.php
r1 r3 1 1 <? 2 include('stat_functions.php'); 3 include('db.php'); 4 DB_Init('localhost', 'stat', '', 'statistic'); 2 include('global.php'); 5 3 6 4 if(array_key_exists('MeasureId', $_GET) and array_key_exists('Value', $_GET)) -
code.php
r1 r3 1 <? 1 <?php 2 2 /* 3 3 ISO8859-2 <-> UTF-8 conversion functions designed for use in PHP-GTK apps -
database.php
r1 r3 10 10 function select($Table, $What = '*', $Condition = 1) 11 11 { 12 return($this->query("SELECT ".$What." FROM ".$this->Prefix.$Table." WHERE ".$Condition)); 12 $Query = "SELECT ".$What." FROM `".$this->Prefix.$Table."` WHERE ".$Condition; 13 return($this->query($Query)); 13 14 } 14 15 15 16 function delete($Table, $Condition) 16 17 { 17 $this->query("DELETE FROM ".$this->Prefix.$Table."WHERE ".$Condition);18 $this->query("DELETE FROM `".$this->Prefix.$Table."` WHERE ".$Condition); 18 19 } 19 20 … … 31 32 $Name = substr($Name, 1); 32 33 $Values = substr($Values, 1); 33 $this->query('INSERT INTO '.$this->Prefix.$Table-' ('.$Name.') VALUES('.$Values.')'); 34 $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 35 //echo('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 34 36 } 35 37 36 38 function update($Table, $Condition, $Data) 37 39 { 40 $Values = ''; 38 41 foreach($Data as $Key => $Value) 39 42 { … … 43 46 } 44 47 $Values = substr($Values, 2); 45 $this->query('UPDATE '.$this->Prefix.$Table.'SET '.$Values.' WHERE ('.$Condition.')');48 $this->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')'); 46 49 } 47 50 … … 59 62 $Name = substr($Name, 1); 60 63 $Values = substr($Values, 1); 61 $this->query('REPLACE INTO '.$this->Prefix.$Table.' ('.$Name.') VALUES('.$values.')');64 $this->query('REPLACE INTO `'.$this->Prefix.$Table.'` (`'.$Name.'`) VALUES('.$values.')'); 62 65 } 63 66 -
error.log
r1 r3 8 8 /var/www/html/statistic/new/graph.php(42) GetValues('8','Undefined variable: Row','/var/www/html/statistic/new/stat_functions.php','307','a:7:{s:7:"Measure";a:23:{i:0;s:1:"2";s:2:"id";s:1:"2";i:1;s:7:"inet_up";s:4:"name";s:7:"inet_up";i:2;s:17:"Internet odesláno";s:11:"description";s:17:"Internet odesláno";i:3;s:4:"1288";s:7:"divider";s:4:"1288";i:4;s:6:"kbit/s";s:4:"unit";s:6:"kbit/s";i:5;s:1:"0";s:10:"continuity";s:1:"0";i:6;s:2:"60";s:6:"period";s:2:"60";i:7;s:7:"inet_up";s:8:"old_name";s:7:"inet_up";i:8;s:9:"localhost";s:16:"privileged_hosts";s:9:"localhost";i:9;s:0:"";s:4:"info";s:0:"";i:10;s:1:"1";s:7:"enabled";s:1:"1";s:17:"ContinuityEnabled";i:0;}s:8:"TimeFrom";s:10:"1183925682";s:6:"TimeTo";s:10:"1184530482";s:5:"Level";d:0;s:13:"DivisionCount";i:500;s:5:"Debug";i:0;s:6:"Values";a:0:{}}') 9 9 10 # 2007-08-18 10:14:25 : mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'stat'@'localhost' (using password: YES) 11 C:\www\dev\statistic\db.php(23) mysql_connect('localhost','stat','serepes') 12 C:\www\dev\statistic\graph.php(6) DB_Init('localhost','stat','','statistic') 13 14 # 2007-08-18 10:16:57 : mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'stat'@'localhost' (using password: YES) 15 C:\www\dev\statistic\db.php(23) mysql_connect('localhost','stat','serepes') 16 C:\www\dev\statistic\graph.php(6) DB_Init('localhost','stat','','statistic') 17 18 # 2007-08-18 10:19:16 : mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'stat'@'localhost' (using password: YES) 19 C:\www\dev\statistic\db.php(23) mysql_connect('localhost','stat','serepes') 20 C:\www\dev\statistic\graph.php(6) DB_Init('localhost','stat','','statistic') 21 -
graph.php
r1 r3 1 1 <?php 2 include('error.php'); 3 include('stat_functions.php'); 4 include('db.php'); 5 include('code.php'); 6 DB_Init('localhost', 'stat', '', 'statistic'); 7 DB_Query('SET CHARACTER SET latin2'); 2 include('global.php'); 8 3 9 4 if(array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug']; -
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.