- Timestamp:
- Apr 30, 2010, 4:27:34 PM (15 years ago)
- Location:
- code/Website
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/Website/cfg/mysql.php
r7856 r7878 2 2 function connectdb() 3 3 { 4 mysql_connect("localhost:3306", "root", "d ennis")4 mysql_connect("localhost:3306", "root", "d3nn1s") 5 5 or die("Error connecting to mysql: " . mysql_error()); 6 6 mysql_select_db('save_energy') -
code/Website/graph_bar.php
r7849 r7878 5 5 6 6 7 $result = mysql_query("select AVG(value) AS average FROM tuples LEFT JOIN sensors ON tuples.sensorID=sensors.sensorID WHERE end IS NULL GROUP BY sensors.roomID"); 7 $result = mysql_query(" 8 select AVG(`tuples`.value) AS average, `rooms`.name AS xaxis 9 FROM (`save_energy`.`tuples`) 10 JOIN `save_energy`.`sensors` ON (`tuples`.sensorID=`sensors`.sensorID) 11 JOIN `save_energy`.`rooms` ON (`sensors`.roomID=`rooms`.roomID) 12 WHERE `sensors`.name LIKE '%power' 13 AND DATE(`tuples`.start) = CURRENT_DATE() - INTERVAL 1 DAY 14 GROUP BY `rooms`.name;"); 8 15 9 16 $data = array(); … … 11 18 { 12 19 $data[] = intval($row['average']); 20 $xaxis[] = ($row['xaxis']); 13 21 } 14 22 15 $title = new title( 'All rooms' );23 $title = new title( 'Alle kamers' ); 16 24 17 25 $bar = new bar(); 18 26 $bar->colour( '#BF3B69'); 19 $bar->key('Gemiddelde ', 14);27 $bar->key('Gemiddelde energieverbruik van gisteren in Watt', 14); 20 28 $bar->set_values( $data ); 21 29 $bar->set_on_click("bar_1"); … … 35 43 $x = new x_axis(); 36 44 $x->colour('#000000')->grid_colour('#D8D8D8'); 37 $x_legend = new x_legend( 'Kamer ID' );45 $x_legend = new x_legend( 'Kamer nummer' ); 38 46 $x_legend->set_style( '{font-size: 14px; color: #000000}' ); 47 48 $x_labels = new x_axis_labels(); 49 $x_labels->set_colour( '#000000' ); 50 $x_labels->set_labels( $xaxis ); 51 $x->set_labels( $x_labels ); 52 39 53 40 54 … … 50 64 //$chart->add_element( $bar2 ); 51 65 66 echo $chart->toPrettyString(); 67 $chartwrite = $chart->toPrettyString(); 52 68 53 echo $chart->toString(); 69 $fh = fopen("graphs/bar.txt", 'w') or die("can't open file"); 70 fwrite($fh, $chartwrite); 71 fclose($fh); 54 72 ?> -
code/Website/graph_line.php
r7849 r7878 77 77 78 78 echo $chart->toPrettyString(); 79 $chartwrite = $chart->toPrettyString(); 79 80 80 $content="test"; 81 $fh = fopen("graphs/".$room."_".$description.".txt", 'w') or die("can't open file"); 82 fwrite($fh, $chartwrite); 83 fclose($fh); 84 85 81 86 ?> -
code/Website/index.php
r7849 r7878 25 25 <div id="content"> 26 26 <h1>Home</h1> 27 <h2>Welkom</h2> 28 <p>Welkom op de website van Save Energy Leiden. <br /> <br />Zie "Grafieken" voor de laatste metingen, "Uitleg" voor een uitleg waarvoor deze website dient, en "info" voor overige informatie.</p> 27 <h2>Welkom!</h2> 28 <p>Welkom op de website van Save Energy Leiden. 29 <?php 30 session_start(); 31 if (session_is_registered("session_user") && session_is_registered("session_id")) 32 { 33 } 34 else 35 { 36 echo "Als u de grafieken wilt bekijken kunt u hieronder inloggen.</p> 37 <FORM ACTION='login.php' METHOD=POST> 38 <table width='214' height='95' border='0'> 39 <tr> 40 <td width='48' class='para'>Gebruikersnaam</td> 41 <td width='105'><input type=TEXT name='username' size=16></td> 42 <td width='47'> </td> 43 </tr> 44 <tr> 45 <td class='para'>Wachtwoord</td> 46 <td><input type=password name='password' size=16></td> 47 <td><input type=SUBMIT name='SUBMIT' value='Login'></td> 48 </tr> 49 </table> 50 </FORM> 51 "; 52 } 53 ?> 29 54 30 55 <div id="chart"></div> -
code/Website/page1.php
r7849 r7878 1 1 <?php 2 session_start(); 3 if (session_is_registered("session_user") && session_is_registered("session_id")) 4 { 2 5 3 6 include_once 'cfg/mysql.php'; … … 48 51 "open-flash-chart.swf", "chart", 49 52 "100%", "300", "9.0.0", "expressInstall.swf", 50 {"data-file":"graph _<?php echo $page ?>.php"});53 {"data-file":"graphs/<?php echo $page ?>.txt"}); 51 54 52 55 function bar_1(chart_id) … … 85 88 <br /> 86 89 <br /> 87 <? php90 <? 88 91 if($page=='line') 89 92 { … … 117 120 118 121 </html> 122 <? 123 } 124 else 125 { 126 header('location:index.php'); 127 } 128 ?>
Note:
See TracChangeset
for help on using the changeset viewer.