summaryrefslogtreecommitdiffstats
path: root/api/php/api.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--api/php/api.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/api/php/api.php b/api/php/api.php
index 780408c..1140dde 100644
--- a/api/php/api.php
+++ b/api/php/api.php
@@ -14,9 +14,9 @@
exit("400: Napaka. Niste vnesli sporočila.");
}
if ($_REQUEST['submit'] != 'Objavi!') {
- http_response_code(201); // he's obviously automating queries
+ http_response_code(400);
header("Content-Type: text/plain");
- exit("201: Uspelo! Komentar objavljen."); // lies and deception
+ exit("400: Napaka. Izgleda, kakor da avtomatizirate zahteve. Koda napake: fuckoff");
}
if (empty($_REQUEST['parent'])) {
http_response_code(400);
@@ -24,9 +24,9 @@
exit("400: Napaka. V zahtevi ni določeno, na kaj odgovarjate.");
}
if (empty($_REQUEST["is-submitter-human"] != "true")) {
- http_response_code(201); // he's obviously automating queries
+ http_response_code(400);
header("Content-Type: text/plain");
- exit("201: Uspelo! Komentar objavljen."); // lies and deception
+ exit("400: Napaka. Izgleda, kakor da avtomatizirate zahteve. Koda napake: jebise");
}
$sporocilo = $_REQUEST['message'];
$parent = $_REQUEST['parent'];
@@ -44,8 +44,13 @@
"ip" => $_SERVER['REMOTE_ADDR'],
"addedby" => "PHP API 0.0.0",
"nonce" => hash('sha256', $vzdevek."|".$datum."|".random_bytes(69))
- ));
- file_put_contents($commentsfile, $cm, FILE_APPEND); // pri append ni locka
+ i));
+ $response = file_put_contents($commentsfile, $cm, FILE_APPEND); // pri append ni locka
+ if ($response === FALSE) {
+ http_response_code(500);
+ header("Content-Type: text/plain");
+ exit("500: Napaka. Komentarja ni uspelo zapisati.");
+ }
break;
case "commentedit":
http_response_code(400);