diff --git a/phpCourse.code-workspace b/phpCourse.code-workspace index 362d7c2..9cb4822 100644 --- a/phpCourse.code-workspace +++ b/phpCourse.code-workspace @@ -3,5 +3,10 @@ { "path": "." } - ] + ], + "settings": { + "cSpell.words": [ + "benutzer" + ] + } } \ No newline at end of file diff --git a/tasks/functions/index.php b/tasks/functions/index.php index 46f36da..ee6ce46 100644 --- a/tasks/functions/index.php +++ b/tasks/functions/index.php @@ -3,7 +3,7 @@
-Es sind $anz_de Firmen in Deutschland ansässig.
"; + echo "Es sind $anz_fr Firmen in Frankreich ansässig.
"; + + echo "$name hat Art.Nr. 1
"; + + echo "Exotic Liquids liefert $anz_exotic Artikel
"; + + echo "Before price hike
"; + $query = "SELECT A.Einzelpreis FROM Artikel AS A, Lieferanten AS L WHERE A.LieferantenNr = L.LieferantenNr AND L.Firma = 'Tokyo Traders'"; + $stmt = $db->prepare($query); + $stmt->execute(); + echo ""; + var_dump($stmt->fetchAll()); + echo ""; + + updPercArticle("Tokyo Traders", 10, $db); + + echo "
After price hike
"; + $query = "SELECT A.Einzelpreis FROM Artikel AS A, Lieferanten AS L WHERE A.LieferantenNr = L.LieferantenNr AND L.Firma = 'Tokyo Traders'"; + $stmt = $db->prepare($query); + $stmt->execute(); + echo ""; + var_dump($stmt->fetchAll()); + echo ""; + + DB::closeConnection($db); + ?> + + + \ No newline at end of file diff --git a/tasks/guestBookDB/actions/comment.php b/tasks/guestBookDB/actions/comment.php new file mode 100644 index 0000000..d91f03f --- /dev/null +++ b/tasks/guestBookDB/actions/comment.php @@ -0,0 +1,45 @@ + 0) { + Headers::redirect("."); + return; +} + +$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/data.json", json_encode($json)); + +Headers::redirect("../"); diff --git a/tasks/guestBookDB/components/.htaccess b/tasks/guestBookDB/components/.htaccess new file mode 100644 index 0000000..872a3ce --- /dev/null +++ b/tasks/guestBookDB/components/.htaccess @@ -0,0 +1,3 @@ +Order deny,allow +Deny from all +Allow from 127.0.0.1 \ No newline at end of file diff --git a/tasks/guestBookDB/components/comment.php b/tasks/guestBookDB/components/comment.php new file mode 100644 index 0000000..bb0c52a --- /dev/null +++ b/tasks/guestBookDB/components/comment.php @@ -0,0 +1,15 @@ +
= nl2br(htmlspecialchars($comment["comment"])) ?>
+