From 0fbd3f2279169144f67c6d75647cf8067676ba9d Mon Sep 17 00:00:00 2001 From: /jedi/ Date: Thu, 27 Dec 2018 08:27:47 +0100 Subject: [PATCH] TAG 0 --- action.php | 49 ++ backend.php | 12 + 404.html => demo/404.html | 16 +- blank.html => demo/blank.html | 16 +- charts.html => demo/charts.html | 24 +- .../forgot-password.html | 12 +- index.html => demo/index.html | 28 +- login.html => demo/login.html | 12 +- register.html => demo/register.html | 12 +- tables.html => demo/tables.html | 22 +- index.php | 30 +- templates/404.php | 35 + templates/dashboard.php | 728 ++++++++++++++---- templates/insert.php | 71 ++ templates/lost.php | 72 ++ templates/page.php | 162 ++++ templates/sidebar.php | 24 +- templates/table.php | 20 +- 18 files changed, 1104 insertions(+), 241 deletions(-) create mode 100644 action.php create mode 100644 backend.php rename 404.html => demo/404.html (92%) rename blank.html => demo/blank.html (92%) rename charts.html => demo/charts.html (91%) rename forgot-password.html => demo/forgot-password.html (79%) rename index.html => demo/index.html (96%) rename login.html => demo/login.html (82%) rename register.html => demo/register.html (87%) rename tables.html => demo/tables.html (97%) create mode 100644 templates/404.php create mode 100644 templates/insert.php create mode 100644 templates/lost.php create mode 100644 templates/page.php diff --git a/action.php b/action.php new file mode 100644 index 0000000..cd58776 --- /dev/null +++ b/action.php @@ -0,0 +1,49 @@ +prepare("INSERT INTO items(was, wann, wo) VALUES (?, ?, ?)"))) { + echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; + } + if (!$stmt->bind_param("sss", $_POST["was"], $_POST["wann"], $_POST["wo"])) { + echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; + } + if (!$stmt->execute()) { + echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error; + } + } + + break; + case "lost": + if (hasval($_POST["was"]) && hasval($_POST["wann"]) && hasval($_POST["wo"]) && hasval($_POST["contact"])) { + /* Prepared statement, stage 1: prepare */ + if (!($stmt = $mysqli->prepare("INSERT INTO lost(was, wann, wo, contact) VALUES (?, ?, ?, ?)"))) { + echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; + } + if (!$stmt->bind_param("ssss", $_POST["was"], $_POST["wann"], $_POST["wo"], $_POST["contact"])) { + echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; + } + if (!$stmt->execute()) { + echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error; + } + } + break; + +} +header('Location: '.$_SERVER['HTTP_REFERER']); + +?> \ No newline at end of file diff --git a/backend.php b/backend.php new file mode 100644 index 0000000..a83492f --- /dev/null +++ b/backend.php @@ -0,0 +1,12 @@ +connect_errno) { + echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; +} +?> \ No newline at end of file diff --git a/404.html b/demo/404.html similarity index 92% rename from 404.html rename to demo/404.html index 5a7f45e..7150e6f 100644 --- a/404.html +++ b/demo/404.html @@ -12,16 +12,16 @@ SB Admin - 404 Error - + - + - + - + @@ -188,14 +188,14 @@ - - + + - + - + diff --git a/blank.html b/demo/blank.html similarity index 92% rename from blank.html rename to demo/blank.html index 1a63b04..ee91f5c 100644 --- a/blank.html +++ b/demo/blank.html @@ -12,16 +12,16 @@ SB Admin - Blank Page - + - + - + - + @@ -186,14 +186,14 @@ - - + + - + - + diff --git a/charts.html b/demo/charts.html similarity index 91% rename from charts.html rename to demo/charts.html index c6e41ae..4694274 100644 --- a/charts.html +++ b/demo/charts.html @@ -12,16 +12,16 @@ SB Admin - Charts - + - + - + - + @@ -221,22 +221,22 @@ - - + + - + - + - + - - - + + + diff --git a/forgot-password.html b/demo/forgot-password.html similarity index 79% rename from forgot-password.html rename to demo/forgot-password.html index 888b932..6523623 100644 --- a/forgot-password.html +++ b/demo/forgot-password.html @@ -12,13 +12,13 @@ SB Admin - Forgot Password - + - + - + @@ -50,11 +50,11 @@ - - + + - + diff --git a/index.html b/demo/index.html similarity index 96% rename from index.html rename to demo/index.html index d075ef0..3f3b392 100644 --- a/index.html +++ b/demo/index.html @@ -9,19 +9,19 @@ - SB Admin - Dashboard + C3CLOC - Dashboard - + - + - + - + @@ -752,23 +752,23 @@ - - + + - + - - - + + + - + - - + + diff --git a/login.html b/demo/login.html similarity index 82% rename from login.html rename to demo/login.html index 03c91c7..2077d81 100644 --- a/login.html +++ b/demo/login.html @@ -12,13 +12,13 @@ SB Admin - Login - + - + - + @@ -60,11 +60,11 @@ - - + + - + diff --git a/register.html b/demo/register.html similarity index 87% rename from register.html rename to demo/register.html index 18c4fcf..16d1883 100644 --- a/register.html +++ b/demo/register.html @@ -12,13 +12,13 @@ SB Admin - Register - + - + - + @@ -78,11 +78,11 @@ - - + + - + diff --git a/tables.html b/demo/tables.html similarity index 97% rename from tables.html rename to demo/tables.html index e95571d..2d04830 100644 --- a/tables.html +++ b/demo/tables.html @@ -12,16 +12,16 @@ SB Admin - Tables - + - + - + - + @@ -677,21 +677,21 @@ - - + + - + - - + + - + - + diff --git a/index.php b/index.php index 2c8ccaf..9d13383 100644 --- a/index.php +++ b/index.php @@ -6,6 +6,8 @@ * Time: 2:49 AM */ +include "backend.php"; + function auth(){ if(!isset($_SERVER['PHP_AUTH_USER'])) return false; @@ -28,34 +30,14 @@ function get_items(){ return $ret; } +$page = isset($_GET["page"])?$_GET["page"]:"dashboard"; + if (!auth()) { header('WWW-Authenticate: Basic realm="C3CLOC"'); header('HTTP/1.0 401 Unauthorized'); + include "templates/404.php"; exit; } else { - ?> - - \ No newline at end of file diff --git a/templates/404.php b/templates/404.php new file mode 100644 index 0000000..5afc9cd --- /dev/null +++ b/templates/404.php @@ -0,0 +1,35 @@ + + +
+ +
+ + + + + +

404

+

Page not found. You can + go back + to the previous page, or + return home.

+ +
+ + + +
+
+ +
+
+ +
+ diff --git a/templates/dashboard.php b/templates/dashboard.php index 1417e6b..e366366 100644 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -6,154 +6,620 @@ * Time: 4:46 AM */ ?> - - +
- +
- - - - - + + - SB Admin - Tables - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - -