$usr != null) { if ($usrData->$usr == $key) { die('0'); $_SESSION["verified"] = true; } else { die('1'); } } else { die('2'); } } } $usrData->$usr = $key; file_put_contents(dirname(__FILE__) . '/data/usr.pw', json_encode($usrData)); die(); } if (!isset($_SESSION['verified']) and $_SESSION["verified"] != true) { die(json_encode(array('error' => 'no auth ' . $_SESSION["verified"]))); } if (str_contains($query, 'setconfig')) { $data = json_decode(file_get_contents('php://input'), true); if ($data['fileName'] == '') { die(json_encode(array('error' => 'no data given')));; } $formFile = dirname(__FILE__) . '/data/' . $data['fileName'] . '.conf'; if (is_file($formFile)) { unlink($formFile); } file_put_contents($formFile, $data['data']); die("File " . $data['fileName'] . ' saved'); } $cmd = escapeshellcmd('bin/phpHandler.py ' . $query); $output = shell_exec($cmd); if ($output == '') { die(json_encode(array('error' => 'no command given'))); } echo $output; ?>