added comment publish function
This commit is contained in:
parent
c0ecd271b0
commit
cff371031c
3 changed files with 53 additions and 1 deletions
|
@ -65,8 +65,24 @@ include "../internal/mysql.php";
|
||||||
<img src="/img/Nexus_6P_-_Screenshot_21-576x1024.png">
|
<img src="/img/Nexus_6P_-_Screenshot_21-576x1024.png">
|
||||||
<img src="/img/Nexus_6P_-_Screenshot_31-576x1024.png">
|
<img src="/img/Nexus_6P_-_Screenshot_31-576x1024.png">
|
||||||
<img src="/img/Nexus_6P_-_Screenshot_41-576x1024.png">
|
<img src="/img/Nexus_6P_-_Screenshot_41-576x1024.png">
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<h2>Kommentare:</h2>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<footer includeHTML="/include/footer.php">
|
<footer includeHTML="/include/footer.php">
|
||||||
|
|
|
@ -404,3 +404,23 @@ button{
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #1cb09a;
|
color: #1cb09a;
|
||||||
}
|
}
|
||||||
|
#newComment form input, #newComment form textarea{
|
||||||
|
width: 100%;
|
||||||
|
background: #1a2332;
|
||||||
|
color: #b3b3b3;
|
||||||
|
border: solid #212a39;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newComment form textarea{
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
#newComment form input[type=submit]{
|
||||||
|
background: #1cb09a;
|
||||||
|
color: #fff;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 15px;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: 0;
|
||||||
|
border: 0;
|
||||||
|
}
|
16
newComment.php
Normal file
16
newComment.php
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
include("./internal/mysql.php");
|
||||||
|
|
||||||
|
$ref = $_SERVER["HTTP_REFERER"];
|
||||||
|
$article = $conn->escape_string(explode(".php", explode("Projekte/", $ref)[1])[0]);
|
||||||
|
$name = $conn->escape_string($_POST["name"]);
|
||||||
|
$email = $conn->escape_string($_POST["email"]);
|
||||||
|
$comment = $conn->escape_string($_POST["comment"]);
|
||||||
|
|
||||||
|
$sql = "INSERT INTO comments (name, email, comment, article) VALUES ('$name', '$email', '$comment', '$article')";
|
||||||
|
|
||||||
|
if ($conn->query($sql) === TRUE) {
|
||||||
|
header("Location: $ref");
|
||||||
|
} else {
|
||||||
|
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||||
|
}
|
Loading…
Reference in a new issue