<?php

include("../../../DTM/scripts/WriteMe.php");

//commented out on the 4th of jan 2023
/* 
chdir("../databases");

if(!$_GET["SiteName"]) {
	echo "SiteName1 not placed in GET";
	exit;
}
// version control 08042019. changed the below line from $_GET["P"] to $_GET["D"]
if( $_GET["T"] || $_GET["EC"] || $_GET["D"]){
	$filename = $_GET["SiteName"];
	
	if(!file_exists($filename)){
		$fh = fopen($filename, 'w');
		$ddd = "This is our new file for site: " . $filename . ". We will write Date and time in first column, temperature in the next, EC, then depth";
		fwrite($fh, $ddd);
		fwrite($fh, "\n");
		echo 'just created a new file for you with the filename: ' . $filename;
		fclose($fh);
	}
	
	$f = fopen($filename, "a");
	
	//print date and time to the file...
	$today = date('d/m/y h:i:s A') . ",";
	echo $today;
	echo "<br />";
	fwrite($f, $today); 
	
	if($_GET["T"]) {
		echo 'Temp is: ';
		$stringData = "";
		$stringData = $_GET['T']. ",";
		echo $stringData;
		echo "<br />";
		fwrite($f, $stringData); 
	} else {
		echo 'Temp is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";
		fwrite($f, $stringData);		
	}

	if($_GET["EC"]) {
		echo 'EC is: ';
		$stringData = "";
		$stringData = $_GET['EC'] . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'EC is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}

	if($_GET["D"]) {
		echo 'Depth is: ';
		$stringData = "";
		$stringData = $_GET['D']. ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'Depth is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}
	
	if($_GET["B"]) {
		echo 'Batt is: ';
		$stringData = "";
		$stringData = $_GET['B']. ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'Batt is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}	
	
	if($_GET["U"]) {
		echo 'U is: ';
		$stringData = "";
		$stringData = $_GET['U']. ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'U is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}	
	
	if($_GET["V"]) {
		echo 'V is: ';
		$stringData = "";
		$stringData = $_GET['V']. ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'V is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}		
	
	if($_GET["W"]) {
		echo 'W is: ';
		$stringData = "";
		$stringData = $_GET['W']. ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'W is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}

	if($_GET["X"]) {
		echo 'X is: ';
		$stringData = "";
		$stringData = $_GET['X']. ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'X is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}

	if($_GET["Y"]) {
		echo 'Y is: ';
		$stringData = "";
		$stringData = $_GET['Y']. ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'Y is: ';
		$stringData = "";
		$stringData = "" . ",";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}

	if($_GET["Z"]) {
		echo 'Z is: ';
		$stringData = "";
		$stringData = $_GET['Z'];
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);
	} else {
		echo 'Z is: ';
		$stringData = "";
		$stringData = "";
		echo $stringData;
		echo "<br />";	
		fwrite($f, $stringData);		
	}	
	
	fwrite($f, "\n");
	fclose($f);
} else {
	echo "you have not included any temps, ECs or depths";
	exit;
}
 */
?>