<?php
	require_once("../system.engine/system.core.php");
	
	$mPong = array();
	$a = &$mPong;
	
	global $systemHandler;
	$systemExecution = $systemHandler->loadHandler("EXECUTION");
	/* ### DO YOUR CODES ONLY FROM HERE ### */
	
	if(isset($_GET["files"])) {
		$mError = false;
		$mFiles = array();
		
		$mUploadDir = "../system.uploads/";
		foreach($_FILES as $mFile) {
			if(move_uploaded_file($mFile["tmp_name"], $mUploadDir.basename($mFile["name"]))) { // hash the fucking shitty name and return the hash too
				$mFiles[] = $mUploadDir.$mFile["name"];
				$a["isValid"] = true;
				$a["uploadedImageHash"] = $mFile["name"];
			} else
				$a["isValid"] = false;
		}
	} else
		$a["isValid"] = true;
	
	/* ### DO NOT CHANGE ANYTHING FROM HERE ### */
	header("Content-Type: application/json");
	echo json_encode($mPong);
?>