24 lines
666 B
PHP
24 lines
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();
|
||
|
}
|