diff --git a/public/index.php b/public/index.php deleted file mode 100644 index f82c181..0000000 --- a/public/index.php +++ /dev/null @@ -1,48 +0,0 @@ -setTimestamp($present["timestamp"]); - -?> - - - - - <?php echo $page_title; ?> - - - - - - - -
-

Jetzt gerade im CZI (letztes Update von format('H:i:s d.m.Y'); ?>)


- - - - - - - - - - - - -
NameMAC
-
- - \ No newline at end of file diff --git a/public/present.json b/public/present.json deleted file mode 100644 index 1825229..0000000 --- a/public/present.json +++ /dev/null @@ -1 +0,0 @@ -{"timestamp":1691853251,"identities":[{"mac":"ff:ff:ff:ff:ff:ff","name":"BROADCAST"}]} \ No newline at end of file diff --git a/identities.yaml b/scanner/identities.yaml similarity index 100% rename from identities.yaml rename to scanner/identities.yaml diff --git a/scan.sh b/scanner/scan.sh similarity index 100% rename from scan.sh rename to scanner/scan.sh diff --git a/upload.py b/scanner/upload.py similarity index 100% rename from upload.py rename to scanner/upload.py diff --git a/wifi_map.yaml b/scanner/wifi_map.yaml similarity index 100% rename from wifi_map.yaml rename to scanner/wifi_map.yaml diff --git a/public/bootstrap/css/bootstrap.min.css b/website/bootstrap/css/bootstrap.min.css similarity index 100% rename from public/bootstrap/css/bootstrap.min.css rename to website/bootstrap/css/bootstrap.min.css diff --git a/public/bootstrap/css/bootstrap.min.css.map b/website/bootstrap/css/bootstrap.min.css.map similarity index 100% rename from public/bootstrap/css/bootstrap.min.css.map rename to website/bootstrap/css/bootstrap.min.css.map diff --git a/public/bootstrap/js/bootstrap.bundle.min.js b/website/bootstrap/js/bootstrap.bundle.min.js similarity index 100% rename from public/bootstrap/js/bootstrap.bundle.min.js rename to website/bootstrap/js/bootstrap.bundle.min.js diff --git a/public/bootstrap/js/bootstrap.bundle.min.js.map b/website/bootstrap/js/bootstrap.bundle.min.js.map similarity index 100% rename from public/bootstrap/js/bootstrap.bundle.min.js.map rename to website/bootstrap/js/bootstrap.bundle.min.js.map diff --git a/website/config.php b/website/config.php new file mode 100644 index 0000000..e69de29 diff --git a/website/identities.json b/website/identities.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/website/identities.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/website/index.php b/website/index.php new file mode 100644 index 0000000..4fccccc --- /dev/null +++ b/website/index.php @@ -0,0 +1,89 @@ +setTimestamp($present["timestamp"]); + +if ($_SERVER['REQUEST_METHOD'] == "POST") { + if ( + preg_match($name_pattern, $_POST['name']) != 1 || + preg_match($mac_pattern, $_POST['mac'] != 1) + ) { + http_response_code(400); + die("Bad data"); + } + + $name = $_POST['name']; + $normalized_mac = str_replace('-', ':', strtolower($_POST['mac'])); + $hashed_mac = hash('sha256', $normalized_mac); + + $identities = json_decode(file_get_contents($identities_file), true); + + foreach ($identities as $identity) { + if ( + $identity['name'] == $name || + $identity['mac_hash'] == $hashed_mac + ) { + // TODO show error to user + die("Duplicate data"); + } + } + + // TODO store new identity + + header("Location: /", true, 303); + exit(); +} +?> + + + + <?php echo $page_title; ?> + + + + + + + +
+

Jetzt gerade im CZI (letztes Update von format('H:i:s d.m.Y'); ?>)


+ + + + + + + + + + + +
Name
+


+
+
+
Neues Gerät tracken
+
+
+
+ +
+
+ + \ No newline at end of file diff --git a/website/present.json b/website/present.json new file mode 100644 index 0000000..a2e023a --- /dev/null +++ b/website/present.json @@ -0,0 +1 @@ +{"timestamp":1691853251,"names":["BROADCAST"]} \ No newline at end of file diff --git a/public/update.php b/website/update.php similarity index 100% rename from public/update.php rename to website/update.php