summaryrefslogtreecommitdiffstats
path: root/ru/kolo/api.php
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-12-21 22:07:32 +0100
committersijanec <sijanecantonluka@gmail.com>2020-12-21 22:07:32 +0100
commit9c56ca43842e05407dddc4ebf172a37df7a8382e (patch)
tree82b455bc8df1936d80bc19675f1ae05f13cb35cc /ru/kolo/api.php
parentlinearna kombinacija vektorjev, baza - domača naloga 21 za matematiko, fix (diff)
downloadsola-gimb-2-9c56ca43842e05407dddc4ebf172a37df7a8382e.tar
sola-gimb-2-9c56ca43842e05407dddc4ebf172a37df7a8382e.tar.gz
sola-gimb-2-9c56ca43842e05407dddc4ebf172a37df7a8382e.tar.bz2
sola-gimb-2-9c56ca43842e05407dddc4ebf172a37df7a8382e.tar.lz
sola-gimb-2-9c56ca43842e05407dddc4ebf172a37df7a8382e.tar.xz
sola-gimb-2-9c56ca43842e05407dddc4ebf172a37df7a8382e.tar.zst
sola-gimb-2-9c56ca43842e05407dddc4ebf172a37df7a8382e.zip
Diffstat (limited to '')
-rw-r--r--ru/kolo/api.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/ru/kolo/api.php b/ru/kolo/api.php
new file mode 100644
index 0000000..c085435
--- /dev/null
+++ b/ru/kolo/api.php
@@ -0,0 +1,54 @@
+<?php
+
+ $dbuser = "kolo";
+ $dbhost = "localhost";
+ $dbdb = "kolo";
+ $dbpw = "kolo";
+ header("Content-Type: application/json");
+ if (empty($_REQUEST['k'])) {
+ http_response_code(400);
+ exit ('{"napaka":true,"obvestilo":"Ne vem, na katero kolo se sklicuješ, ker manjka parameter k."}');
+ }
+ switch ($_REQUEST['m']) {
+ case "r": /* registracija */
+ if (empty($_REQUEST['m'])) {
+ http_response_code(400);
+ exit ('{"napaka":true,"obvestilo":"Ne vem, kako ti je ime, ker manjka parameter m"}');
+ }
+ /* sedaj naredimo SQL */
+ break;
+ case "z": /* zakleni kolo, omogoči vrtenje, naključno razporedi osebe */
+ if ($_REQUEST['g'] !== $admin_pass) {
+ http_response_code(400);
+ exit ('{"napaka":true,"obvestilo":"Ne bom zaklenil tega kolesa, ker
+ niste administrator."}');
+ }
+ break;
+ case "u": /* srčni utrip */
+ $r = array();
+ $r["dovoli_vrtenje"] = false;
+ $r["si_administrator"] = false;
+ $r["moznosti_na_kolesu"] = false;
+ http_response_code(200);
+ exit (json_encode($r));
+ break;
+ case "v": /* vrti */
+ if (true /* a je vrtenje nedovoljeno */) {
+ http_response_code(400);
+ exit ('{"napaka":true,"obvestilo":"Ne morem vrteti, ker vrtenja še ni odobril administrator"}');
+ }
+ if (true /* če je uporabnik že zavrtel kolo */) {
+ http_response_code(400);
+ exit ('{"napaka":true,"obvestilo":"Kolesa ne morem vrteti, ker ste ga enkrat že zavrteli."}');
+ }
+ /* pridobi obstoječo vrednost iz tabele in jo označi za taken */
+ http_response_code(200);
+ exit ();
+ break;
+ default:
+ http_response_code(400);
+ exit ('{"napaka":true,"obvestilo":"Ne vem, kaj hočeš,. ker je bila zahtevana napačna metoda, parameter m."}');
+ break;
+ }
+
+?>