diff options
Diffstat (limited to 'api/emergency.php')
-rw-r--r-- | api/emergency.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/api/emergency.php b/api/emergency.php index eb2a054..9a0ed7f 100644 --- a/api/emergency.php +++ b/api/emergency.php @@ -4,14 +4,17 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLogg if (!$isLoggedIn) header("Location: /login") and die(); global $_PROFILE; -file_get_contents('https://ntfy.sh/' . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"], false, stream_context_create([ +$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; + +file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . "Title: [Test] ⚠️🆘 EMERGENCY ⚠️🆘\r\n" . "Priority: urgent\r\n" . - "Tags: emergency", + "Tags: emergency\r\n" . + "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), 'content' => "[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]" ] ])); |