From 00fda2f0dfdaa1129949f0fa116cfaeff23ab486 Mon Sep 17 00:00:00 2001 From: Mateja Date: Mon, 28 Sep 2020 19:14:53 +0200 Subject: first commit --- admin.php | 105 ++++++++++++++++++++++++++++++++++ index.php | 61 ++++++++++++++++++++ logout.php | 7 +++ reservation.php | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ style.css | 135 ++++++++++++++++++++++++++++++++++++++++++++ test/edit.inc.php | 7 +++ test/test.inc.php | 4 ++ test/test.php | 34 +++++++++++ test/test2.php | 56 +++++++++++++++++++ 9 files changed, 573 insertions(+) create mode 100644 admin.php create mode 100644 index.php create mode 100644 logout.php create mode 100644 reservation.php create mode 100644 style.css create mode 100644 test/edit.inc.php create mode 100644 test/test.inc.php create mode 100644 test/test.php create mode 100644 test/test2.php diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..2bfdfde --- /dev/null +++ b/admin.php @@ -0,0 +1,105 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +} catch (PDOException $e) { + echo "

Error!: " . $e->getMessage() . "

"; + die(); +} + +# SHOLUD SOMETHING BE APPROVED? +if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['id']) ) { + $stmt = $conn->prepare("UPDATE activities SET approved = true WHERE id=:id"); +echo "lol:" . $_POST['id']; + $stmt->bindParam(':id', $_POST['id']); + $stmt->execute(); +} + +# IS LOGIN LEGITIMATE? +if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['email']) && isset($_POST['password'])) { + try { + $stmt = $conn->prepare("SELECT * FROM admins WHERE email=:email"); + $stmt->bindParam(':email', $_POST['email']); + $stmt->execute(); + $row = $stmt->fetch(); + if (password_verify($_POST['password'], $row['password'])){ + $_SESSION['admin'] = true; + } else { + $_SESSION['admin'] = false; + } + } catch (PDOException $e) { + echo "

Error!: " . $e->getMessage() . "

"; + } +} +?> + + + + + + + Yota Callplan + + +
YOTA
+ +
+'; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + foreach($conn->query("SELECT * FROM activities WHERE approved = false") as $row) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ''; + echo "\n"; + } + echo "
ImePrezimeGodineActions
" . $row['name'] . "" . $row['surname'] . "" . $row['age'] . "
'; + echo ''; + echo ''; + echo '
\n\n"; + } catch (PDOException $e) { + echo "

Error!: " . $e->getMessage() . "

"; + } +} else { + # Bad pass check... + if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['admin']) && $_SESSION['admin'] == false) echo "Bad credentials!"; + # Login form + echo '
'; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'; +} +?> +
+ + diff --git a/index.php b/index.php new file mode 100644 index 0000000..47b4069 --- /dev/null +++ b/index.php @@ -0,0 +1,61 @@ + + + + + + + + Yota Callplan + + +
YOTA
+ +
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + echo '
'; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + foreach($db->query("SELECT * FROM $table where approved=true") as $row) { + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + } + + echo "
ImePrezimeGodine
" . $row['name'] . "" . $row['surname'] . "" . $row['age'] . "
\n
\n"; + } catch (PDOException $e) { + echo "

Error!: " . $e->getMessage() . "

"; + die(); + } +?> +
+ + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..be295fd --- /dev/null +++ b/logout.php @@ -0,0 +1,7 @@ + diff --git a/reservation.php b/reservation.php new file mode 100644 index 0000000..84949c5 --- /dev/null +++ b/reservation.php @@ -0,0 +1,164 @@ + + + + + + + + Yota Callplan + + +
YOTA
+ +
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $stmt = $conn->prepare("INSERT INTO activities (name, surname, age) VALUES (:name, :surname, :age)"); + $stmt->bindParam(':name', $_POST['fname']); + $stmt->bindParam(':surname', $_POST['lname']); + $stmt->bindParam(':age', $_POST['age']); + $stmt->execute(); + echo "

Data inserted.

"; + } catch (PDOException $e) { + echo "

Error!: " . $e->getMessage() . "

"; + } +} +?> +
+ + + + + + + +
+ +
+
+
+ +
+ + + + + + + + + + +
+ I will be active on bands: + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ +
+ I will use modes: + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ + + + + + + + + + + + + + +
+ +
+ + diff --git a/style.css b/style.css new file mode 100644 index 0000000..7fee13f --- /dev/null +++ b/style.css @@ -0,0 +1,135 @@ +body { + margin: 0; + padding: 0; + font-family: monospace; +} + +/* HEADER AND NAVBAR STYLING */ +header { + background-color:black; + padding: 1rem; +} +header a { + background-color:black; + text-decoration: none; + font-size: 3rem; + color: white; +} +header a:hover { + text-decoration: underline; +} + +nav { + background-color:black; + overflow-x: hidden; +} +nav a { + color: white; + background-color:black; + font-size: 1rem; + text-decoration: none; + text-align: center; + padding: 1rem; + float: left; +} +nav a.right { + float: right; +} +nav a:hover { + text-decoration: underline; +} +.active { + font-weight: bold; +} +.right { + float: right; +} + +/* MAIN STYLING */ +main { + margin: 1rem auto; + max-width: 750px; + + line-height: 1.6rem; + font-size: 1rem; + + color: #444; + + padding: 0 10px; +} +h1,h2,h3 { + line-height: 1.2; +} +a { + color: #0077AA; +} + +/* TABEL STYLING */ +table { + margin: 2rem 0; + border-collapse: collapse; + width: 100%; +} + +td, th { + border: 1px solid #ccc; + text-align: left; + padding: 8px; +} + +tr:nth-child(even) { + background-color: #ddd; +} + +/* FORM STYLING */ +input, select { + width: 100%; + padding: 12px 10px; + margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + box-sizing: border-box; + font-size: 1rem; +} + +input[type=submit] { + width: 100%; + background-color: #ddd; + color: black; + border: #ccc 1px solid; + padding: 14px 20px; + margin: 8px 0; +} + +input[type=submit] { + background-color: #ddd; +} + +input[type=checkbox] { + padding: 0; + margin: 0; + width: auto; +} + +input[type=submit]:hover { + background-color: #ccc; +} + +input[type=submit].abtn { + background-color: #afa; +} +input[type=submit].abtn:hover { + background-color: #8f8; +} + +@media only screen and (max-width: 750px) { +header { + text-align: center; +} + nav a { + width: 100%; + text-align: center; + margin: 0; + padding: 1rem 0; + } +} diff --git a/test/edit.inc.php b/test/edit.inc.php new file mode 100644 index 0000000..cb0c23f --- /dev/null +++ b/test/edit.inc.php @@ -0,0 +1,7 @@ + + + + + + + Test + + +
+"; + } else { + echo "You oki: " . $email . "
"; + } +} +function clear_input($data) { + $data = trim($data); + $data = stripslashes($data); + $data = htmlspecialchars($data); + return $data; +} +include 'test.inc.php'; +?> +
+ + +
+
+ + diff --git a/test/test2.php b/test/test2.php new file mode 100644 index 0000000..8f2c697 --- /dev/null +++ b/test/test2.php @@ -0,0 +1,56 @@ + + + + +Test table + + + + + + +\n"; + echo "NameActions\n"; + foreach ($conn->query("SELECT * FROM tbl1") as $row) { + echo "" . $row['name'] . ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + } + echo "\n"; +} +catch (PDOException $e) { + echo $e->getMessage(); +} +?> + + -- cgit v1.2.3