<head>
    <title>Red Jacket Robotics - Admin</title>
</head>

<?PHP

$basedir    = '../';

$directories = scandir($basedir);

if (!isset($_GET["action"])) {
	$action = "";
} else {
	$action = $_GET["action"];
}

if($action == 'deploy'){
	foreach($directories as $Value){
		
		echo "<p>" . "Deployed The Template to " . $Value . "</p>". "<br>";
		
		if(ctype_upper(substr($Value,0,1)) == true){
			
			copy("index.php", "$basedir/$Value/index.php");
		
		$filename = "$basedir/$Value/mainContent.php";
		
			if (file_exists($filename)){

			}else{
			$myfile = fopen($filename, "w") or die("Unable to open file!");
			$txt = "";
			fwrite($myfile, $txt);
			}
		
		
		}
	}
}
	?>

<a style="font-size: 20px;" href="?action=deploy">Deploy Template</a>