diff options
author | sijanec <sijanecantonluka@gmail.com> | 2020-12-02 00:20:38 +0100 |
---|---|---|
committer | sijanec <sijanecantonluka@gmail.com> | 2020-12-02 00:20:38 +0100 |
commit | 12144750ad1118a2a79e2765afeded39b6b2606e (patch) | |
tree | f72c62702d33ca37fbe0f6156d89ef33e1be3ae2 | |
parent | popravil v (diff) | |
download | sijanec.eu-12144750ad1118a2a79e2765afeded39b6b2606e.tar sijanec.eu-12144750ad1118a2a79e2765afeded39b6b2606e.tar.gz sijanec.eu-12144750ad1118a2a79e2765afeded39b6b2606e.tar.bz2 sijanec.eu-12144750ad1118a2a79e2765afeded39b6b2606e.tar.lz sijanec.eu-12144750ad1118a2a79e2765afeded39b6b2606e.tar.xz sijanec.eu-12144750ad1118a2a79e2765afeded39b6b2606e.tar.zst sijanec.eu-12144750ad1118a2a79e2765afeded39b6b2606e.zip |
-rw-r--r-- | api/php/api.php | 17 |
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); |