summaryrefslogtreecommitdiff
path: root/includes/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/functions.php')
-rw-r--r--includes/functions.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/includes/functions.php b/includes/functions.php
new file mode 100644
index 0000000..7146795
--- /dev/null
+++ b/includes/functions.php
@@ -0,0 +1,15 @@
+<?php declare(strict_types=1);
+
+function respondAndExit(int $responseCode, string $header, array $headers = []): void
+{
+ header($header, false, $responseCode);
+
+ foreach ($headers as $header) {
+ header($header);
+ }
+
+ header("Access-Control-Allow-Origin: *");
+ header('Content-Type: text/plain; charset=UTF-8');
+
+ exit();
+}