From 7ee66f95d9289a0a3c348a36bed77777f9868d7b Mon Sep 17 00:00:00 2001 From: William Date: Mon, 24 Jan 2022 11:54:42 +0100 Subject: [PATCH] Add unfinished simulator --- app/model/Simulator.php | 11 +++++++++++ app/view/simulator.php | 8 ++++++++ public/api/get_times.php | 11 +++++++++++ public/simulator.php | 18 ++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 app/model/Simulator.php create mode 100644 app/view/simulator.php create mode 100644 public/api/get_times.php create mode 100644 public/simulator.php diff --git a/app/model/Simulator.php b/app/model/Simulator.php new file mode 100644 index 0000000..4747fd0 --- /dev/null +++ b/app/model/Simulator.php @@ -0,0 +1,11 @@ +database = $database; + } +} \ No newline at end of file diff --git a/app/view/simulator.php b/app/view/simulator.php new file mode 100644 index 0000000..29f41bf --- /dev/null +++ b/app/view/simulator.php @@ -0,0 +1,8 @@ +

Simulator

+

Skriv inn et kortnummer:

+
+ +
+
+ +
\ No newline at end of file diff --git a/public/api/get_times.php b/public/api/get_times.php new file mode 100644 index 0000000..245f5dc --- /dev/null +++ b/public/api/get_times.php @@ -0,0 +1,11 @@ +database->conn->prepare($sql); +$stmt->execute(); + + +$app->api([ + "data" => $stmt->fetchAll(PDO::FETCH_ASSOC) +]); \ No newline at end of file diff --git a/public/simulator.php b/public/simulator.php new file mode 100644 index 0000000..03b0002 --- /dev/null +++ b/public/simulator.php @@ -0,0 +1,18 @@ +model('Simulator'); + +if ($_SERVER['REQUEST_METHOD'] === 'POST') +{ + if (!isset($_POST['cardnumber']) || empty($_POST['cardnumber'])) + { + $app->session->flash('Kortnummer kan ikke være tom!', 'danger'); + } else { + $app->session->flash("Kortnummer: \"{$_POST['cardnumber']}\" er ikke blitt lastet opp men burde bli implementert snart!", 'success'); + } +} + +$app->view('template/header', ['title' => 'Simulator']); +$app->view('simulator'); +$app->view('template/footer'); \ No newline at end of file