From feb736e4f4902e2addac97e761a7c67f919ac2d0 Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Wed, 1 Nov 2023 12:52:00 +0100 Subject: [PATCH] =?utf8?q?Rozpocz=C4=99cie=20prac=20na=20lib.morketsmerke.?= =?utf8?q?org?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- db_conf.php | 20 ++++++++++++ index.php | 56 ++++++++++++++++++++++++++++++++ install.sql | 41 +++++++++++++++++++++++ library.php | 83 +++++++++++++++++++++++++++++++++++++++++++++++ modules/login.php | 27 +++++++++++++++ style.css | 54 ++++++++++++++++++++++++++++++ 6 files changed, 281 insertions(+) create mode 100644 db_conf.php create mode 100644 index.php create mode 100644 install.sql create mode 100644 library.php create mode 100644 modules/login.php create mode 100644 style.css diff --git a/db_conf.php b/db_conf.php new file mode 100644 index 0000000..47cc73a --- /dev/null +++ b/db_conf.php @@ -0,0 +1,20 @@ +console.log('Połaczenie nie powiodło się'); + console.log(\"Nr błędu: " . mysqli_connect_errno() . "\"); + console.log(\"Błąd: " . mysqli_connect_error() . "\");"; + exit; + } else { + if ( ! isset($_SERVER["SHELL"]) ) { + echo ""; + } + } + +?> diff --git a/index.php b/index.php new file mode 100644 index 0000000..7022797 --- /dev/null +++ b/index.php @@ -0,0 +1,56 @@ + + + + + Library of morketsmerke.org + + + + +
+
+ baner +
+ +
+
+ + +
+
+ + Główna filia biblioteki morketsmerke.org"; + echo "

Tutaj może znaleźć wiele interesujących pozycji"; + echo "czytelniczych, choć niektóre zasoby mogą być niedostępne.

"; + } + ?> +
+
+ +
+ + diff --git a/install.sql b/install.sql new file mode 100644 index 0000000..7cb7f1f --- /dev/null +++ b/install.sql @@ -0,0 +1,41 @@ +CREATE DATABASE library; +CREATE USER 'library'@'localhost' IDENTIFIED BY 'Sup3rT4jn3H4s1087400'; +GRANT ALL on library.* TO 'library'@'localhost'; + +USE library; + +CREATE TABLE users ( + id int AUTO_INCREMENT PRIMARY KEY, + login varchar(30), + pass_hash text +); + +CREATE TABLE books ( + id int AUTO_INCREMENT PRIMARY KEY, + type int, + title text, + author text, + publisher text, + publishing int, + pubdate int, + category int, + ISBN text, + adnotes text, + description text +); + +CREATE TABLE notes ( + id int AUTO_INCREMENT PRIMARY KEY, + title text, + author text, + source text, + adnotes text, + description text +); + +CREATE TABLE categories ( + id int AUTO_INCREMENT PRIMARY KEY, + name text +); + +INSERT INTO users (login, pass_hash) VALUES ('xf0r3m', '$2y$10$oIr8ekrD8z5AA1BK0Mqt0OBmgRwq6Mf3GCFRztade1YxlipQwr2AW'); diff --git a/library.php b/library.php new file mode 100644 index 0000000..87bc33b --- /dev/null +++ b/library.php @@ -0,0 +1,83 @@ + 0) ) { + if ( ! isset($_SERVER["SHELL"]) ) { + echo ""; + } + return true; + } else { + echo ""; + return false; + } +} + +function dbQuery($connection, $tableName, $columnScheme, $whereValue, $debug=0) { + $query = "SELECT " . $columnScheme . " FROM " . $tableName . " WHERE " . $whereValue; + if ( $debug == 1 ) { var_dump($query); } + $result = mysqli_query($connection, $query); + + if ( mysqliResult($connection, $result) ) { + return $result; + } else { + echo ""; + } + +} + +function getFieldValue($result) { + $row = mysqli_fetch_row($result); + return $row[0]; +} + +function dbUpdate($connection, $tableName, $setValue, $whereValue) { + $query = "UPDATE " . $tableName . " SET " . $setValue . " WHERE " . $whereValue; + $result = mysqli_query($connection, $query); + + if ( mysqliResult($connection, $result) ) { + return $result; + } else { + echo ""; + } + +} + +function dbAdd($connection, $tableName, $columnScheme, $setValues) { + $query = "INSERT INTO " . $tableName . " (" . $columnScheme . ") VALUES (" . $setValues . ");"; + $result = mysqli_query($connection, $query); + + if ( mysqliResult($connection, $result) ) { + return $result; + } else { + echo ""; + } +} + +function dbDel($connection, $tableName, $whereValue) { + $query = "DELETE FROM " . $tableName . " WHERE " . $whereValue; + $result = mysqli_query($connection, $query); + + if ( mysqliResult($connection, $result) ) { + return $result; + } else { + echo ""; + } +} + +function newFormatTo80Cols($long_string, $linePrefix, $eolSign) { + $content = array(); + if ( strlen($long_string) > 80 ) { + $toExplode = wordwrap($long_string, 80, "|", false); + $exploded = explode("|", $toExplode); + $i=0; + foreach ( $exploded as $line ) { + $content[$i] = $linePrefix . $line . $eolSign; + $i += 1; + } + } else { + $content[0] = $linePrefix . $long_string . $eolSign; + } + return $content; +} + +?> diff --git a/modules/login.php b/modules/login.php new file mode 100644 index 0000000..d392e6b --- /dev/null +++ b/modules/login.php @@ -0,0 +1,27 @@ +Niepoprawny login lub hasło"; + } + } else { + echo "

Niepoprawny login lub hasło

"; + } + } +?> +
+
+
+
+

+ +
diff --git a/style.css b/style.css new file mode 100644 index 0000000..7f01ce0 --- /dev/null +++ b/style.css @@ -0,0 +1,54 @@ +#root-container { + width: 860px; + margin-right: auto; + margin-left: auto; +} + +#baner-container { + width: inherit; + height: 200px; +} + +#menu-container, #footer-container { + width: inherit; + height: 30px; +} + +#main-content-container { + width: inherit; + float: left; + min-height: 300px; + margin-top: 10px; +} + +#side-menu-container { + width: 172px; + float: left; +} + +#content-container { + width: 683px; + float: left; + padding-left: 5px; +} + +#footer-container { + float: left; + text-align: center; +} + +.main-menu-element { + float: left; + margin-right: 5px; +} + +.ul-menu { + list-style-type: none; + padding: 0; + margin: 0; +} + +button { + border-radius: unset; + border: 1px solid; +} -- 2.39.5