45 lines
1.4 KiB
PHP
45 lines
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ö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öffentlichen"><br>
|
||
|
<p>Mit dem klick auf den obigen Button erklären sie sich mit der <a href="/datenschutzerklaerung.html">Datenschutzerklärung</a> einverstanden.</p>
|
||
|
</form>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
EOF);
|
||
|
}
|