diff --git a/base/errors.php b/base/errors.php deleted file mode 100644 index 32d7093..0000000 --- a/base/errors.php +++ /dev/null @@ -1,4 +0,0 @@ - + + + + + + Colour Selector + + + + + + + + +
+ + +
+
+
+ + +
+ Please enter valid hex colour code +
+
+ +
+ + + \ No newline at end of file diff --git a/homework/colourSelector/js/formValidation.js b/homework/colourSelector/js/formValidation.js new file mode 100644 index 0000000..77f2903 --- /dev/null +++ b/homework/colourSelector/js/formValidation.js @@ -0,0 +1,33 @@ +"use strict"; + +document.addEventListener("DOMContentLoaded", () => { + const _switch = document.getElementById("clientSideValidate"); + _switch.addEventListener("change", () => + _switch.checked ? addValidation() : removeValidation() + ); +}); + +const handler = (event) => { + if (!event.target.checkValidity()) { + event.preventDefault(); + event.stopPropagation(); + } + + event.target.classList.add("was-validated"); +}; + +const addValidation = () => { + const forms = document.querySelectorAll(".needs-validation"); + + Array.from(forms).forEach((form) => { + form.addEventListener("submit", handler, false); + }); +}; + +const removeValidation = () => { + const forms = document.querySelectorAll(".needs-validation"); + + Array.from(forms).forEach((form) => { + form.removeEventListener("submit", handler, false); + }); +}; diff --git a/tasks/calc/index.php b/tasks/calc/index.php index 17dcaa7..fe42874 100644 --- a/tasks/calc/index.php +++ b/tasks/calc/index.php @@ -1,5 +1,5 @@ - + @@ -11,7 +11,7 @@ + + + + + + Counter + + + + time() + 60 * 60 * 24, "samesite" => "strict", "secure" => true, "httponly" => true]); + } + } + flock($fh, LOCK_UN); + fclose($fh); + + Headers::html(); + ?> +

Visitor count:

+ + + \ No newline at end of file diff --git a/tasks/guestBook/actions/comment.php b/tasks/guestBook/actions/comment.php index e0fb52b..d91f03f 100644 --- a/tasks/guestBook/actions/comment.php +++ b/tasks/guestBook/actions/comment.php @@ -1,5 +1,5 @@ "},{"time":1716546110,"title":"JS Inject","name":"Kilian","comment":"