-Folgen und Nicht mehr Folgen verfügbar -Kleine Verbsesserungen Signed-off-by: erik <micheler@steinbeis.schule>
24 lines
No EOL
666 B
PHP
24 lines
No EOL
666 B
PHP
<?php
|
|
|
|
session_start();
|
|
include "../db_connect.php";
|
|
|
|
if (!isset($_SESSION['user_id']) || !isset($_POST['following_id'])) {
|
|
header("location: ../index.php");
|
|
}
|
|
|
|
$follower_id = $_SESSION['user_id'];
|
|
$following_id = $_POST['following_id'];
|
|
$username = $_POST['username'];
|
|
|
|
if ($following_id == $follower_id) {
|
|
die("Geht nicht Amk");
|
|
}
|
|
|
|
try {
|
|
$stmt = $pdo->prepare("DELETE FROM followers WHERE following_id = :following_id AND follower_id = :follower_id");
|
|
$stmt->execute(['follower_id' => $follower_id, 'following_id' => $following_id]);
|
|
header("location: ../profile.php?user=" . $username);
|
|
} catch (PDOException $e) {
|
|
echo $e->getMessage();
|
|
} |