[Firebug-cvs] firebug/web/demo temphum.php,NONE,1.1 graphem.php,1.1,1.2
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2004-04-02 16:53:43
|
Update of /cvsroot/firebug/firebug/web/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24508/demo Modified Files: graphem.php Added Files: temphum.php Log Message: Started a file for plotting temperature and humidity. --- NEW FILE: temphum.php --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Results demo script</title> <link rel="SHORTCUT ICON" href="../images/favicon.ico"> <link type="text/css" rel="stylesheet" href="../firebug.css"> </head> <body> <h1>Demonstration monitoring</h1> <?php $dbname = "gpsradio"; $tblname = "location"; //$dbname = $HTTP_POST_VARS["db1"]; //$tblname = $HTTP_SESSION_VARS["tblname"]; //$checkboxname = $HTTP_SESSION_VARS["cb"]; $radiox = $HTTP_POST_VARS["radiox"]; $radioy = $HTTP_POST_VARS["radioy"]; $xmin = $HTTP_POST_VARS["xmin"]; $xmax = $HTTP_POST_VARS["xmax"]; //echo "Radio x: ".$radiox;echo "Radio y: ".$radioy; mysql_connect("localhost","root","") or die("Error: ".mysql_error()." in mysql_connect."); $dblink=mysql_select_db("$dbname") or die("Error: ".mysql_error()." in mysql_select_db."); ?> <?php //include "db_print_table.php"; ?> <table> <tr> <td> <form action="graphem.php" method="post"> <table> <tr> <td>mote_id</td> <td><input type=radio name=radiox value="mote_id"</td> <td><input type=radio name=radioy value="mote_id"</td> </tr> <tr> <td>gps_hours</td> <td><input type=radio name=radiox value="gps_hours"</td> <td><input type=radio name=radioy value="gps_hours"</td> </tr> <tr> <td>gps_minutes</td> <td><input type=radio name=radiox value="gps_minutes"</td> <td><input type=radio name=radioy value="gps_minutes"</td> </tr> <tr> <td>gps_seconds</td> <td><input type=radio name=radiox value="gps_seconds"</td> <td><input type=radio name=radioy value="gps_seconds"</td> </tr> <tr> <td>lat_deg</td> <td><input type=radio name=radiox value="lat_deg"</td> <td><input type=radio name=radioy value="lat_deg"</td> </tr> <tr> <td>lat_dec_min</td> <td><input type=radio name=radiox value="lat_dec_min"</td> <td><input type=radio name=radioy value="lat_dec_min"</td> </tr> <tr> <td>long_deg</td> <td><input type=radio name=radiox value="long_deg"</td> <td><input type=radio name=radioy value="long_deg"</td> </tr> <tr> <td>long_dec_min</td> <td><input type=radio name=radiox value="long_dec_min"</td> <td><input type=radio name=radioy value="long_dec_min"</td> </tr> <tr> <td>nsew</td> <td><input type=radio name=radiox value="nsew"</td> <td><input type=radio name=radioy value="nsew"</td> </tr> <tr> <td>numsats</td> <td><input type=radio name=radiox value="numsats"</td> <td><input type=radio name=radioy value="numsats"</td> </tr> </table> <input type=hidden name=db1 value="dbname"> <input type=submit value="Plot"> </form> </td> <!-- <form action="graphem.php" method="post"> <table> <tr> <td>mote_id</td> <td><input type=radio name=radiox value="mote_id"</td> <td><input type=radio name=radioy value="mote_id"</td> </tr> <tr> <td>time</td> <td><input type=radio name=radiox value="time"</td> <td><input type=radio name=radioy value="time"</td> </tr> <tr> <td>count</td> <td><input type=radio name=radiox value="cnt"</td> <td><input type=radio name=radioy value="cnt"</td> </tr> <tr> <td>RSSI</td> <td><input type=radio name=radiox value="rssi"</td> <td><input type=radio name=radioy value="rssi"</td> </tr> </table> <input type=hidden name=db1 value="dbname"> <input type=submit value="Plot"> </form> --> <?php $dbname = "gpsradio"; $statement = "use $dbname"; mysql_query($statement) or die("Error: ".mysql_error()." changing databases"); if ($radioy == null) { print("Error, must choose a y value\n"); // statement for selecting against y value only. } if ($radiox == null) { $statement = "select $radioy from location where lat_deg = 37 and long_deg = 122"; } else { $statement = "select $radiox,$radioy from location where lat_deg = 37 and long_deg = 122"; } $result = mysql_query($statement) or die("Error: ".mysql_error()." in select statement"); if (!$ofp=fopen("test.dat","w")) { echo "Unable to open data output file for writing.\n"; } if(!chmod ("test.dat", 0775)) { echo "chmod failed\n"; } function print_row($item2,$key) { fwrite($ofp,$item2); } if ($row = mysql_fetch_row($result)) { // for each row do { // For each column... $row = array_values($row); $size = count($row); for ($i=0; $i<$size; $i++) { // This is no good for multiple columns. fwrite($ofp,$row[$i]." "); } fwrite($ofp,"\n"); } while ($row = mysql_fetch_row($result)); } fclose($ofp); // This stuff doesn't work yet, but would be // be a better way to do this. Move all this // kind of stuff into dedicated functions. //$command = "echo -e 'set term png\n"; $command = "'set term png\n"; $command .= "set size 0.4\n"; //$command .= "plot \"test2.dat\"\n'"; $command .= "plot \"test.dat\"\n'"; //$command .= "| C:/gp373w32/pgnuplot.exe > test.png"; $command .= "| C:/gp373w32/pgnuplot.exe > test.png"; //$plotcommand = "echo -e 'set term png\n"; $plotcommand = "'set term png\n"; $plotcommand .= "set size 0.4\n"; $plotcommand .= "set output \"test.png\"\n"; $plotcommand .= "plot \"test.dat\" with lines 2'"; $plotstring = "set term png\n"; $plotstring .= "set size 0.5\n"; $plotstring .= "set output \"test.png\"\n"; $plotstring .= "plot \"test.dat\" with lines 2"; $gnuplot = " | C:\\gp373w32\\pgnuplot.exe"; //echo $command; // System call $systemcall = $plotcommand; $systemcall .= $gnuplot; $gnufile = "test2.gnu"; //$ofp = fopen("test1.gnu","w"); $ofp = fopen($gnufile,"w"); fwrite($ofp,$plotstring); fclose($ofp); //system("C:\\gp373w32\\pgnuplot.exe < ./test1.gnu"); //Try the redirect going the other way with an output file name. system("C:\\gp373w32\\pgnuplot.exe < ./$gnufile"); // > $outfile.png /* print("<pre>"); print($plotcommand.$gnuplot); print("</pre>"); */ //This doesn't work either. //`$plotcommand.$gnuplot`; /* $systemcall = $plotcommand; $systemcall .= $gnuplot; $e = escapeshellcmd($systemcall); // This would be preferable, but doesn't seem to work. if(system("echo -e $systemcall",$error)) { echo "System call succeeded\n"; } else { echo "System call failed with error $error\n"; } print("<pre>"); print($e); print("</pre>"); */ ?> <td> <img src="test.png"> </td> </tr> </table> <?php include("../nav_footer.php"); //$radiox = null; //$radioy = null; ?> <hr /> <p> Last Updated: $Date: 2004/04/02 16:41:32 $ by $Author: doolin $. </p> </body> </html> Index: graphem.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/demo/graphem.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** graphem.php 2 Apr 2004 00:18:36 -0000 1.1 --- graphem.php 2 Apr 2004 16:41:32 -0000 1.2 *************** *** 42,46 **** ?> ! <form action="graphem.php" method="post"> --- 42,48 ---- ?> ! <table> ! <tr> ! <td> <form action="graphem.php" method="post"> *************** *** 110,115 **** --- 112,150 ---- <input type=submit value="Plot"> </form> + </td> + + + <!-- + <form action="graphem.php" method="post"> + <table> + <tr> + <td>mote_id</td> + <td><input type=radio name=radiox value="mote_id"</td> + <td><input type=radio name=radioy value="mote_id"</td> + </tr> + + <tr> + <td>time</td> + <td><input type=radio name=radiox value="time"</td> + <td><input type=radio name=radioy value="time"</td> + </tr> + + <tr> + <td>count</td> + <td><input type=radio name=radiox value="cnt"</td> + <td><input type=radio name=radioy value="cnt"</td> + </tr> + <tr> + <td>RSSI</td> + <td><input type=radio name=radiox value="rssi"</td> + <td><input type=radio name=radioy value="rssi"</td> + </tr> + </table> + <input type=hidden name=db1 value="dbname"> + <input type=submit value="Plot"> + </form> + --> <?php *************** *** 182,186 **** $plotstring = "set term png\n"; ! $plotstring .= "set size 0.8\n"; $plotstring .= "set output \"test.png\"\n"; $plotstring .= "plot \"test.dat\" with lines 2"; --- 217,221 ---- $plotstring = "set term png\n"; ! $plotstring .= "set size 0.5\n"; $plotstring .= "set output \"test.png\"\n"; $plotstring .= "plot \"test.dat\" with lines 2"; *************** *** 228,236 **** */ - echo "<center>"; - echo "<img src=\"test.png\">"; - echo "</center>"; ?> --- 263,274 ---- */ ?> + <td> + <img src="test.png"> + </td> + </tr> + </table> + |