website/internal/comments.php

45 lines
No EOL
1.4 KiB
PHP

<?php
function getComments($article){
include "mysql.php";
include "getGravatar.php";
echo(" <h2>Kommentare:</h2>");
$result = $conn->query("SELECT * FROM comments WHERE article='$article'");
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$name = $row["name"] . "<br>";
$gravatar = get_gravatar($row["email"]);
$content = $row["comment"];
echo(<<<EOF
<h3 class="commentTitle">$name</h3>
<div class="comment">
<img src="$gravatar">
<article class="commentArticle">
<p class="commentText">$content</p>
</article>
</div>
EOF);
}
}
echo(<<<EOF
<div id="newComment">
<form action="/newComment.php" method="post">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br><br>
<label for="email">E-Mail: (wird nicht ver&ouml;ffentlicht)</label><br>
<input type="text" id="email" name="email"><br><br>
<label for="comment">Kommentar:</label><br>
<textarea name="comment" id="comment"></textarea><br><br>
<input type="submit" value="Kommentar ver&ouml;ffentlichen"><br>
<p>Mit dem klick auf den obigen Button erkl&auml;ren sie sich mit der <a href="/datenschutzerklaerung.html">Datenschutzerkl&auml;rung</a> einverstanden.</p>
</form>
</div>
EOF);
}