<?php
include_once("../../../auth.php");
if (isset($_GET['vdir']) && $_GET['vdir'] != ""){
	$vdir = $_GET['vdir'];
	$storePath = time();
	if (file_exists("index/" . $vdir . ".index")){
	    if (!file_exists("tmp/" . $storePath)){
    		mkdir("tmp/" . $storePath, 0777, true);
    	}
		$output = shell_exec('arozdfs.exe download -vdir "' . $vdir . '" -storepath "' . "tmp/" . $storePath . '"'); //Change this line to other binary if you are not running on Window Host
		echo $storePath;
	}else{
		die("ERROR. Targeting file not exists.");
	}
	
}else{
	die("ERROR. Undefined vdir for downloading.");
}
?>