{"wizard_id"}; $uname = $json_response->{"wizard_info"}->{"wizard_name"}; $s = "SELECT COUNT(uid) AS c FROM player WHERE uid = $uid AND api_key = '$key';"; if (1 != $db->query($s)->fetchArray(SQLITE3_ASSOC)["c"]){ http_response_code(401); return 401; } // Run TOA run parser script $cmd = __DIR__ . "/bin/upload_run_toa.py " . $key . " " . escapeshellarg($data_request) . " " . escapeshellarg($data_response); $out = []; $ret = 0; try{ exec($cmd, $out, $ret); } catch(Exception $e) { error_log("Error running TOA run script: " . $e->getMessage()); http_response_code(500); return 500; } if ($ret != 201){ try{ http_response_code($ret); return $ret; } catch(Exception $e) { error_log("TOA run script returned an unexpected value $ret: " . $e->getMessage()); http_response_code(500); return 500; } } // At this point, status code should be 200 http_response_code($ret); return $ret; } catch(Exception $e) { error_log("Unknown error parsing TOA run: " . $e->getMessage()); http_response_code(500); return 500; } ?>