From 09bd0164ebc020a54b944b7326dcba496fb5d82c Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 26 Aug 2022 22:29:23 +0200 Subject: idk when was the last commit so I'm making a new one - Violet Dawn --- api/emergency-real.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'api/emergency-real.php') diff --git a/api/emergency-real.php b/api/emergency-real.php index 20a918f..6a569e8 100644 --- a/api/emergency-real.php +++ b/api/emergency-real.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: ⚠️🆘 EMERGENCY ⚠️🆘\r\n" . "Priority: urgent\r\n" . - "Tags: emergency", + "Tags: emergency\r\n" . + "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), 'content' => "This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!" ] ])); -- cgit