summaryrefslogtreecommitdiff
path: root/api/emergency.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-10 00:04:25 +0200
committerMinteck <contact@minteck.org>2022-08-10 00:04:25 +0200
commit0417260bf158c5d7b62888dae2e202b0de115a05 (patch)
tree7f54ee56da118813f2d1b3a324d322d0c74fa51b /api/emergency.php
downloadpluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.gz
pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.bz2
pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.zip
Initial commit
Diffstat (limited to 'api/emergency.php')
-rw-r--r--api/emergency.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/api/emergency.php b/api/emergency.php
new file mode 100644
index 0000000..eb2a054
--- /dev/null
+++ b/api/emergency.php
@@ -0,0 +1,19 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn;
+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([
+ 'http' => [
+ 'method' => 'POST',
+ 'header' =>
+ "Content-Type: text/plain\r\n" .
+ "Title: [Test] ⚠️🆘 EMERGENCY ⚠️🆘\r\n" .
+ "Priority: urgent\r\n" .
+ "Tags: emergency",
+ 'content' => "[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]"
+ ]
+]));
+
+die(); \ No newline at end of file