From 4085cbb71316fabbd99b59b8938c0e74450a3da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C5=A1nar?= Date: Fri, 29 Nov 2024 16:34:12 +0100 Subject: [PATCH] initial commit with working version (for improvement) --- src/index.html | 76 +++++++++++++++++++++++++++++++++++ src/osvobdoch_local_vars.php | 6 +++ src/osvobdoch_vars.php | 5 +++ src/pruchod.php | 77 ++++++++++++++++++++++++++++++++++++ src/veskole.php | 17 ++++++++ 5 files changed, 181 insertions(+) create mode 100644 src/index.html create mode 100644 src/osvobdoch_local_vars.php create mode 100644 src/osvobdoch_vars.php create mode 100644 src/pruchod.php create mode 100644 src/veskole.php diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..2a03212 --- /dev/null +++ b/src/index.html @@ -0,0 +1,76 @@ + + + + + + +

Osvobozená základní škola - Docházka

+

Ukaž svoji školní průkazku

+
+ + + + +

Kdo jsi?

+

Načítám ...

+

+

Kdo je ve škole

+

Načítám ...

+ + + diff --git a/src/osvobdoch_local_vars.php b/src/osvobdoch_local_vars.php new file mode 100644 index 0000000..5d70ec6 --- /dev/null +++ b/src/osvobdoch_local_vars.php @@ -0,0 +1,6 @@ + + diff --git a/src/osvobdoch_vars.php b/src/osvobdoch_vars.php new file mode 100644 index 0000000..45fd530 --- /dev/null +++ b/src/osvobdoch_vars.php @@ -0,0 +1,5 @@ + + diff --git a/src/pruchod.php b/src/pruchod.php new file mode 100644 index 0000000..193dbb3 --- /dev/null +++ b/src/pruchod.php @@ -0,0 +1,77 @@ +direction == "P") { + if( !in_array($pozadavek->name, $at_school)) { + $at_school[] = $pozadavek->name; + } else { + echo $pozadavek->name." už je ve škole"; + return; + } +} else { + //if student is already at school, remove him from the list + if( in_array($pozadavek->name, $at_school)) { + $key = array_search($pozadavek->name, $at_school); + unset($at_school[$key]); + } else { + echo $pozadavek->name." není ve škole"; + return; + } +} + + +$pruchod = array( + "PkUzivatel" => $pozadavek->id, + "TypUzivatele" => "P", + "Datum" => date("Y-m-d"), + "Cas" => date("H:i:s"), + "Smer" => $pozadavek->direction, + "Hlavni" => $pozadavek->main, + "BranaId" => "ENTRANCE", + "CteckaId" => "CAM1", + "Poznamka" => "" +); +$payload = json_encode($pruchod)."
"; +echo $payload; +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, $url.$cesta); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_POST, true); +curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "com.edookit.Time: ".$cas, + "com.edookit.Auth: ".$auth, + "com.edookit.Client: ".$id, + "Content-Type: application/json" +)); +/*curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); +$result = curl_exec($ch); +echo $result;*/ +file_put_contents('at_school.txt', ' diff --git a/src/veskole.php b/src/veskole.php new file mode 100644 index 0000000..c598c76 --- /dev/null +++ b/src/veskole.php @@ -0,0 +1,17 @@ +