<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Update Name/Version Mobile Device Tool</title>
<link rel="stylesheet" type="text/css" href="../css/reset.css" media="screen" />
<link rel="stylesheet" type="text/css" href="../css/main_style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="../css/layout.css" media="screen" />
</head>
<body id="menu1">
	<div id="mainWrapper">
		<div id="topBannerContainer">
			<div id="logoContainer">
  				<img src="../images/banner.png" alt="CFTT Federated Testing - NIST">
			</div>
            <!-- Menu Starts-->
			<div id="menuContainer">
                          <?php
                                include '../include/global.php';
                                print_main_horizontal_menu_contents();
                          ?>
    		</div>
            <!-- Menu Ends-->
		</div>
		<!-- TopBanner Ends-->
 
		<!-- Main Content Starts-->	
		<div id="subContentContainer">
		  <div id="leftContent">
		    <div id="leftLinks">
			  <div>
<?php
include '../include/mdt-global.php';
?>
		      </div>
		    </div>
		  </div>			
		  <div id="rightContent">
<!--		    <div id="breadcrumb"><a href="../Federated_Testing_Home_Page.php">Home</a> > Test a disk imaging tool</div>-->
		    <div id="breadcrumb"><a href="../Federated_Testing_Home_Page.php" class="nav">Home</a> &gt; <a href="/mobiledevice/mdt.php" class="nav"> Test a Mobile Device tool</a> &gt; Entering Tool Name and Version</div>

<?php
	$continue = 1;

	// is_ftlogs_mounted() returns the path to where we should store log files (e.g.,  
	// /tmp or /media/FT-LOGS). It also checks if the user has mounted their log drive.
	// is_ftlogs_mounted() will return 0/false and print an error message if the 
	// user's log drive is not mounted
	$path = is_ftlogs_mounted();

	if (!$path) { 
		// if the user's log drive isn't mounted, don't continue
		$continue = 0;
	}

	// if the user's log drive isn't mounted, don't continue
	if ($continue){
		echo "<h1>Entering Tool Name and Version (2 of 2)</h1>";

		$filename = 'mdt-config.txt';
		$tn = $_POST['toolname']; // pull in tool name and version passed from the form
		$tv = $_POST['toolversion']; // on the previous page

		// see if we can open the config file
		if ($c_file = fopen ($path."/".$filename, "w")){ 
			// write tool name and version to the config file
			echo "tn: ".$tn."";
			fwrite($c_file, "garbage".$tn." ".$tv." holtz\n");
			fwrite($c_file, $tn);
			fwrite($c_file, "garbage4\n");
			fwrite($c_file, $filename."\n");
			fwrite($c_file, $tn);
			fwrite($c_file, $tv);
			fwrite($c_file, $_POST['toolname']);
			fwrite($c_file, $_POST['toolversion']);
			fclose($c_file);
			echo "'".$filename."' written to '".$path."' <br><br>";
			echo '<div style="padding: 1em 1em 0.5em 1em; background: #eeeeee ';
			echo 'url("images/ui-bg_highlight-soft_100_eeeeee_1x100.png") 50% top repeat-x;">';
	//	printf ('<h2>Tool: %s, Version: %s</h2>',$_POST['toolname'],$_POST['toolversion']);
			echo '<p>Tool name: &nbsp;&nbsp;&nbsp;<i>'.$tn.'</i></p>';
			echo '<p>Tool version: <i>'.$tv.'</i></p>';
			echo '</div><br>	';
			echo '<p>Click to <a href="mdt.php">return to the Mobile Device Home Page</a></p>';
		} else {
			echo "<p><b>Error: <i>".basename($_SERVER['PHP_SELF'])."</i> encountered ";
			echo "an error trying to write to ".$path."/".$filename.".</b></p>";
		}
	}
?>
		</div>
		<div class="push"></div>
	</div>
   <!-- Footer Starts-->
        <?php
     $fn = $_SERVER["SCRIPT_FILENAME"];
          print_footer_contents($fn);
        ?>
    <!-- Footer Ends-->
</div></body></html>
