2018-12-06 00:58:20 +01:00
|
|
|
<?php
|
|
|
|
include "../settings/db_connect.php";
|
|
|
|
$_SESSION['message'] = '';
|
2018-12-12 21:20:00 +01:00
|
|
|
$post=$_GET['post'];
|
2018-12-06 00:58:20 +01:00
|
|
|
if ($_SERVER['REQUEST_METHOD'] == "POST"){
|
|
|
|
$tekst = $mysqli->real_escape_string($_POST['tekst']);
|
|
|
|
$_SESSION['tekst'] = $tekst;
|
|
|
|
$sql = "INSERT INTO comments (tekst)"
|
|
|
|
. "Values ('$tekst')";
|
|
|
|
|
|
|
|
if($mysqli->query($sql) === true){
|
|
|
|
$_SESSION['message'] = "Dodanie komentarza się powiodło!";
|
2018-12-12 21:20:00 +01:00
|
|
|
header("location:post.php?post=$post");
|
2018-12-06 00:58:20 +01:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
$_SESSION['message'] = "Nie udało się dodać komentarza!";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|