<html>
<head>
<title>RTF 331: Soundscapes Project 2</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body id="controlBody">
<div id="controlWrapper">
<?php
// Write the control signal if the post variable was sent
if (isset($_POST['controlsignal'])){
$file = fopen("data.php","w");
fwrite($file,$_POST["controlsignal"]);
fclose($file);}
// Write the tracking signal if the post variable was sent
if (isset($_POST['trackingsignal'])){
$file = fopen("tracker.php","w");
fwrite($file,$_POST["trackingsignal"]);
fclose($file);}
// Write the unique signal if the post variable was sent
if (isset($_POST['uniquesignal'])){
$file = fopen("movieinfo.php","r+");
fgets($file);
$srcname = fgets($file);
$srcwidth = fgets($file);
$srcheight = fgets($file);
$line2 = $_POST["uniquesignal"] . "\n" . $srcname . $srcwidth . $srcheight;
rewind($file);
ftruncate($file, 0);
fwrite($file, $line2);
fclose($file);}
// Write the movie filename if the post variable was sent
if ($_POST['moviefilename'] != ""){
$file = fopen("movieinfo.php","r+");
$uniquenum = fgets($file);
$srcname = fgets($file);
$srcwidth = fgets($file);
$srcheight = fgets($file);
$line1 = $uniquenum . $_POST["moviefilename"] . "\n" . $srcwidth . $srcheight;
rewind($file);
ftruncate($file, 0);
fwrite($file, $line1);
fclose($file);}
// Write the movie width if the post variable was sent
if ($_POST['moviewidth'] != ""){
$file = fopen("movieinfo.php","r+");
$uniquenum = fgets($file);
$srcname = fgets($file);
$srcwidth = fgets($file);
$srcheight = fgets($file);
$line1 = $uniquenum . $srcname . $_POST["moviewidth"] . "\n" . $srcheight;
rewind($file);
ftruncate($file, 0);
fwrite($file, $line1);
fclose($file);}
// Write the movie height if the post variable was sent
if ($_POST['movieheight'] != ""){
$file = fopen("movieinfo.php","r+");
$uniquenum = fgets($file);
$srcname = fgets($file);
$srcwidth = fgets($file);
$srcheight = fgets($file);
$line1 = $uniquenum . $srcname . $srcwidth . $_POST["movieheight"] . "\n";
rewind($file);
ftruncate($file, 0);
fwrite($file, $line1);
fclose($file);}
// Print the current control signal
$file = fopen("data.php", "r");
echo "controlsignal: " . fgets($file) . "<br/>";
fclose($file);
// Print the current tracking signal
$file = fopen("tracker.php", "r");
echo "trackingnumber: " . fgets($file) . "<br/>";
fclose($file);
// Print the unique signal and movie name
$file = fopen("movieinfo.php", "r");
echo "uniquesignal: " . fgets($file) . "<br/>";
echo "moviefilename: " . trim(fgets($file)) . ".mov<br/>";
echo "size: " . trim(fgets($file)) . "x" . trim(fgets($file)) . "<br/>";
fclose($file);
?>
<br/>
<form action="control.php" method="post">
<input type="radio" name="controlsignal" value="8" /> (8) Rewind<br/>
<input type="radio" name="controlsignal" value="7" /> (7) Visual Test (Tracking Number)<br/>
<input type="radio" name="controlsignal" value="6" /> (6) Visual Test (Synchronous)<br/>
<input type="radio" name="controlsignal" value="5" /> (5) Visual Test (Cascading)<br/>
<input type="radio" name="controlsignal" value="4" /> (4) Visual Test Reset<br/>
<input type="radio" name="controlsignal" value="1" /> (1) 1 Second Ping Timeout<br/>
<input type="radio" name="controlsignal" value="0" /> (0) 0 Second Ping Timeout<br/><br/>
<input type="radio" name="controlsignal" value="9" /> (9) Play<br/><br/>
<input type="radio" name="trackingsignal" value="1" /> (TRUE) Clear Tracking<br/><br/>
<input type=SUBMIT VALUE="submit"><br/><br/><br/>
<input type="radio" name="uniquesignal" value="2" /> (2) Unique Audio<br/>
<input type="radio" name="uniquesignal" value="1" /> (1) Unique Movies<br/>
<input type="radio" name="uniquesignal" value="0" /> (0) One Movie<br/><br/>
Filename: <input type="text" name="moviefilename"/>
Size: <input type="text" name="moviewidth" size=1/> x
<input type="text" name="movieheight" size=1/><br/>* Do not include ".mov"
<br/><br/>
<input type="radio" name="controlsignal" value="12345" /> (12345) KILL
</form>
</div>
</body>
</html>