website/public/internal/comments.php
2021-01-11 19:14:33 +01:00

47 lines
No EOL
1.6 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
<script src='https://www.hCaptcha.com/1/api.js' async defer></script>
<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>
<div class="h-captcha" data-theme="dark" data-sitekey="$sitekey"></div><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);
}