diff --git a/base/meta.php b/base/meta.php index 9c4e7ea..7cd848a 100644 --- a/base/meta.php +++ b/base/meta.php @@ -1,3 +1,7 @@ + + + + \ No newline at end of file diff --git a/tasks/guestBook/comment.php b/tasks/guestBook/actions/comment.php similarity index 80% rename from tasks/guestBook/comment.php rename to tasks/guestBook/actions/comment.php index 53360bc..e0fb52b 100644 --- a/tasks/guestBook/comment.php +++ b/tasks/guestBook/actions/comment.php @@ -1,6 +1,6 @@ 0) { return; } -$string = file_get_contents("data.json") ?? "[]"; +$string = file_get_contents("../data/data.json") ?? "[]"; $json = json_decode($string); array_push($json, ["time" => $time, "title" => $title, "name" => $name, "comment" => $comment]); -file_put_contents("data.json", json_encode($json)); +file_put_contents("../data/data.json", json_encode($json)); -Headers::redirect("."); +Headers::redirect("../"); diff --git a/tasks/guestBook/components/comment.php b/tasks/guestBook/components/comment.php index 7b1748f..68db2d9 100644 --- a/tasks/guestBook/components/comment.php +++ b/tasks/guestBook/components/comment.php @@ -1,7 +1,7 @@
-
title ?>
+
title ?>
name ?>
diff --git a/tasks/guestBook/components/newComment.php b/tasks/guestBook/components/newComment.php index d5c87bf..52e5e90 100644 --- a/tasks/guestBook/components/newComment.php +++ b/tasks/guestBook/components/newComment.php @@ -1,4 +1,4 @@ -
+

Leave a Comment!

diff --git a/tasks/guestBook/data.json b/tasks/guestBook/data.json deleted file mode 100644 index cb47af9..0000000 --- a/tasks/guestBook/data.json +++ /dev/null @@ -1,93 +0,0 @@ -[ - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { - "time": 1715337098, - "title": "The first", - "name": "Kilian", - "comment": "The first comment on here." - }, - { "time": 1715338381, "title": "sdf", "name": "dsaf", "comment": "dsg" }, - { - "time": 1715339761, - "title": "Witzige Aufgabe", - "name": "Kilian", - "comment": "nun ja, also das funktioniert ja schon recht gut gell." - }, - { - "time": 1716539658, - "title": "Progress Bar", - "name": "Kilian", - "comment": "Jetzt auch mit einem etwas geileren Progress Bar der einem die Character-Anzahl anzeigt.\r\nWesentlich geiler, wesentlich nicer, und Bootstraped" - } -] diff --git a/tasks/guestBook/data/.htaccess b/tasks/guestBook/data/.htaccess new file mode 100644 index 0000000..54aa684 --- /dev/null +++ b/tasks/guestBook/data/.htaccess @@ -0,0 +1,2 @@ +DENY FROM ALL +ALLOW FROM 127.0.0.1 \ No newline at end of file diff --git a/tasks/guestBook/data/data.json b/tasks/guestBook/data/data.json new file mode 100644 index 0000000..1095930 --- /dev/null +++ b/tasks/guestBook/data/data.json @@ -0,0 +1 @@ +[{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715337098,"title":"The first","name":"Kilian","comment":"The first comment on here."},{"time":1715338381,"title":"sdf","name":"dsaf","comment":"dsg"},{"time":1715339761,"title":"Witzige Aufgabe","name":"Kilian","comment":"nun ja, also das funktioniert ja schon recht gut gell."},{"time":1716539658,"title":"Progress Bar","name":"Kilian","comment":"Jetzt auch mit einem etwas geileren Progress Bar der einem die Character-Anzahl anzeigt.\r\nWesentlich geiler, wesentlich nicer, und Bootstraped"},{"time":1716541941,"title":"New layout","name":"Kilian","comment":"New folder structure"}] \ No newline at end of file diff --git a/tasks/guestBook/index.php b/tasks/guestBook/index.php index 9b90e7a..dcb31f4 100644 --- a/tasks/guestBook/index.php +++ b/tasks/guestBook/index.php @@ -6,8 +6,8 @@ Guest Book - - + + @@ -22,7 +22,7 @@ $errors = $_SESSION["error"] ?? []; $_SESSION["error"] = []; - $string = file_get_contents("data.json") ?? "[]"; + $string = file_get_contents("./data/data.json") ?? "[]"; $json = array_reverse(json_decode($string)); if (isset($_GET["p"]) && !is_numeric($_GET["p"])) { diff --git a/tasks/guestBook/formValidation.js b/tasks/guestBook/js/formValidation.js similarity index 100% rename from tasks/guestBook/formValidation.js rename to tasks/guestBook/js/formValidation.js diff --git a/tasks/guestBook/textarea.js b/tasks/guestBook/js/textarea.js similarity index 100% rename from tasks/guestBook/textarea.js rename to tasks/guestBook/js/textarea.js