-Nachrichten Senden -Design verbessert -Kleine Verbesserungen Signed-off-by: erik <micheler@steinbeis.schule>
23 lines
539 B
PHP
23 lines
539 B
PHP
<?php
|
|
session_start();
|
|
include "../db_connect.php";
|
|
|
|
if(!isset($_SESSION['user_id']) || !isset($_POST['post_id'])){
|
|
header("location: ../index.php");
|
|
}
|
|
|
|
$like_id = $_SESSION['user_id'];
|
|
$liked_id = $_POST['post_id'];
|
|
$username = $_POST['username'];
|
|
|
|
|
|
try {
|
|
$like_abfrage = $pdo->prepare("INSERT INTO likes (user_id, post_id) VALUES (:user_id, :post_id)");
|
|
$like_abfrage->execute([':user_id' => $like_id, ':post_id' => $liked_id]);
|
|
header("location: ../index.php");
|
|
}
|
|
catch(PDOException $e){
|
|
echo $e->getMessage();
|
|
}
|
|
|
|
|