- Uploaden von Posts möglich - Kleine verbesserung vorgenommen Signed-off-by: erik <micheler@steinbeis.schule>
27 lines
No EOL
571 B
PHP
27 lines
No EOL
571 B
PHP
<?php
|
|
session_start();
|
|
include "../db_connect.php";
|
|
|
|
$userId = $_SESSION['user_id'];
|
|
|
|
$stmt = $pdo->prepare("SELECT file_path FROM profile_pictures WHERE user_id = :id");
|
|
$stmt->execute([':id' => $userId]);
|
|
$user = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if($user && !empty($user['file_path'])){
|
|
$file_Path = "../" . $user['file_path'];
|
|
|
|
if(file_exists($file_Path)){
|
|
unlink($file_Path);
|
|
}
|
|
|
|
$stmt = $pdo->prepare("DELETE FROM profile_pictures WHERE user_id = :id");
|
|
$stmt->execute([':id' => $userId]);
|
|
}
|
|
|
|
header("Location: ../index.php");
|
|
exit;
|
|
|
|
|
|
|
|
?>
|