[Firebug-cvs] firebug/web db_write_file.php,NONE,1.1 db_table_select.php,1.3,1.4 results.php,1.1,1.2
Brought to you by:
doolin
From: <do...@us...> - 2004-02-11 00:09:08
|
Update of /cvsroot/firebug/firebug/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32302 Modified Files: db_table_select.php results.php test.gnu Added Files: db_write_file.php Log Message: php - mysql - plot connection working. --- NEW FILE: db_write_file.php --- <?php> session_start(); session_register("dbname"); session_register("tblname"); ?> <html> <head> <title>FireBug Client</title> <META HTTP-EQUIV="Refresh" CONTENT="30;URL=http://localhost/firebug/db_write_file.php"> <link rel="SHORTCUT ICON" href="./images/favicon.ico"> <link type="text/css" rel="stylesheet" href="firebug.css"> </head> <body> <?php include("nav_footer.php"); ?> <hr /> <p> Sensor data last updated: <?php echo date ("l dS F Y h:i:s A"); ?> </p> <?php //if (!isset($HTTP_SESSION_VARS["tblname"])) { if ($HTTP_POST_VARS["tbl1"]!=Null){ $HTTP_SESSION_VARS["tblname"] = $HTTP_POST_VARS["tbl1"]; $HTTP_SESSION_VARS["dbname"] = $HTTP_POST_VARS["db1"]; } $dbname = $HTTP_SESSION_VARS["dbname"]; $tblname = $HTTP_SESSION_VARS["tblname"]; print("<h1>Mote activity: Database $dbname, table $tblname</h1>"); ?> <center> <table class="db_schema"> <tr> <td>Mote ID</td> <td>Time</td> <td>Hours</td> <td>Minutes</td> <td>Dec_sec</td> <td>Lat_deg</td> <td>Lat_dec_min</td> <td>Long_deg</td> <td>Long_dec_min</td> <td>NSEWind</td> <td>Temp</td> <td>Cnt </td> </tr> <?php if (!$inside_fp=fopen("testdata.data","w")) { echo "Couldn't open testdata.dat for writing!\n"; } mysql_connect("localhost","root","") or die("Error: ".mysql_error()." in mysql_connect."); mysql_select_db("$dbname") or die("Error: ".mysql_error()." in mysql_select_db."); if ($mote_id == "") { $mote_id = "%"; } if ($time == "") { $time = "%"; } if ($cnt == "") { $cnt = "%"; } if ($hours == "") { $hours = "%"; } if ($minutes == "") { $minutes = "%"; } if ($dec_sec == "") { $dec_sec = "%"; } if ($Lat_deg == "") { $Lat_deg = "%"; } if ($Lat_dec_min == "") { $Lat_dec_min = "%"; } if ($Long_deg == "") { $Long_deg = "%"; } if ($Long_dec_min == "") { $Long_dec_min = "%"; } if ($NSEWind == "") { $NSEWind = "%"; } if ($temp == "") { $temp = "%"; } $result = mysql_query("select * from $tblname where mote_id like '$mote_id%' and time like '$time%' and cnt like '$cnt%' and hours like '$hours%' and minutes like '$minutes%' and dec_sec like '$dec_sec%' and Lat_deg like '$Lat_deg%' and Lat_dec_min like '$Lat_dec_min%' and Long_deg like '$Long_deg%' and Long_dec_min like '$Long_dec_min%' and NSEWind like '$NSEWind%' and temp like '$temp%'") //and rel_hum like '$rel_hum%' //and baro_pres like '$baro_pres%'" or die("Error: ".mysql_error()." in query."); //fputs($inside_fp,"1,3\n"); if ($row = mysql_fetch_array($result)) { do { fputs($inside_fp,$row["mote_id"]." "); /* print $row["time"]; print $row["hours"]; */ fputs($inside_fp,$row["minutes"]."\n"); /* print $row["dec_sec"]; print $row["Lat_deg"]; print $row["Lat_dec_min"]; print $row["Long_deg"]; print $row["Long_dec_min"]; print $row["NSEWind"]; print $row["temp"]; print $row["cnt"]; */ } while ($row = mysql_fetch_array($result)); } fclose($inside_fp); // System call `"C:/gp373w32/pgnuplot.exe < ./test.gnu"`; echo "<img src=\"test.png\">"; $result = mysql_query("select * from $tblname where mote_id like '$mote_id%' and time like '$time%' and cnt like '$cnt%' and hours like '$hours%' and minutes like '$minutes%' and dec_sec like '$dec_sec%' and Lat_deg like '$Lat_deg%' and Lat_dec_min like '$Lat_dec_min%' and Long_deg like '$Long_deg%' and Long_dec_min like '$Long_dec_min%' and NSEWind like '$NSEWind%' and temp like '$temp%'") //and rel_hum like '$rel_hum%' //and baro_pres like '$baro_pres%'" or die("Error: ".mysql_error()." in query."); if ($row = mysql_fetch_array($result)) { do { print ("<tr>"); print ("<td>"); print $row["mote_id"]; print ("</td>"); print ("<td>"); print $row["time"]; print ("</td>"); print ("<td>"); print $row["hours"]; print ("</td>"); print ("<td>"); print $row["minutes"]; print ("</td>"); print ("<td>"); print $row["dec_sec"]; print ("</td>"); print ("<td>"); print $row["Lat_deg"]; print ("</td>"); print ("<td>"); print $row["Lat_dec_min"]; print ("</td>"); print ("<td>"); print $row["Long_deg"]; print ("</td>"); print ("<td>"); print $row["Long_dec_min"]; print ("</td>"); print ("<td>"); print $row["NSEWind"]; print ("</td>"); print ("<td>"); print $row["temp"]; print ("</td>"); print ("<td>"); print $row["cnt"]; print ("</td>"); print ("</tr>"); } while ($row = mysql_fetch_array($result)); } ?> </table> </center> <hr /> <?php include("nav_footer.php"); ?> <hr /> <p> Sensor data last updated: <?php echo date ("l dS F Y h:i:s A"); ?> </p> </body> </html> Index: db_table_select.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/db_table_select.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** db_table_select.php 19 Dec 2003 01:06:02 -0000 1.3 --- db_table_select.php 11 Feb 2004 00:05:24 -0000 1.4 *************** *** 64,67 **** --- 64,70 ---- <?php + + + mysql_connect("localhost","root","") or die("Error: ".mysql_error()." in mysql_connect."); *************** *** 196,199 **** --- 199,204 ---- } + + ?> Index: results.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/results.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** results.php 10 Feb 2004 15:26:27 -0000 1.1 --- results.php 11 Feb 2004 00:05:24 -0000 1.2 *************** *** 14,25 **** <?php - // The following is a system call. - `D:\cygwin\bin\gnuplot.exe < test.gnu`; ?> ! <img src="../imagetest/test.png"> --- 14,45 ---- <?php + /* + if (!file_exists("/tmp/tempdata")) { + echo "Creating /tmp/tempdata...<p>"; + mkdir ("/tmp/tempdata",0755); + } + */ + // This stuff doesn't work yet, but would be + // be a better way to do this. + $command = "echo -e 'set term png\n"; + $command .= "set size 0.4\n"; + $command .= "plot \"test2.dat\"\n'"; + $command .= "| C:/gp373w32/pgnuplot.exe > test.png"; + + //echo $command; + // System call + `"C:/gp373w32/pgnuplot.exe < ./test.gnu"`; + + // This would be preferable, but doesn't seem to work. + //passthru($command); + + + echo "<img src=\"test.png\">"; ?> ! Index: test.gnu =================================================================== RCS file: /cvsroot/firebug/firebug/web/test.gnu,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test.gnu 10 Feb 2004 15:26:54 -0000 1.1 --- test.gnu 11 Feb 2004 00:05:24 -0000 1.2 *************** *** 1,12 **** set term png - set size 0.4 ! ! set output "../imagetest/test.png" ! ! #set xrange [0:2*pi] ! ! #plot sin(x) ! ! plot "test2.dat" \ No newline at end of file --- 1,5 ---- set term png set size 0.4 ! set output "test.png" ! plot "testdata.data" using 2 with line 1 \ No newline at end of file |