<?php

if (isset($_GET['setconfig'])) {
	$data = json_decode(file_get_contents('php://input'), true);
	$formFile = dirname(__FILE__) . '/../data/' . $data['fileName'] . '.conf';

	if (is_file($formFile)) {
		unlink($formFile);
	}

	file_put_contents($formFile, $data['data']);

	die("File " . $data['fileName'] . ' saved!');
}

$query = $_SERVER['PATH_INFO'];
$cmd = escapeshellcmd('../bin/phpHandler.py ' . $query);
$output = shell_exec($cmd);
echo $output;
?>