diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-04-29 18:04:56 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-04-29 18:04:56 +0300 |
commit | 4cee97e695c889445c3146bc8169a89b132855ea (patch) | |
tree | 693489f2f89f86e277255dfe0f9d5482ecad0359 /user/delete.php | |
parent | Add nginx and php-fpm config files (diff) | |
download | bugtracker-4cee97e695c889445c3146bc8169a89b132855ea.tar.xz |
Finish user management
Diffstat (limited to 'user/delete.php')
-rw-r--r-- | user/delete.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/user/delete.php b/user/delete.php new file mode 100644 index 0000000..b46cdce --- /dev/null +++ b/user/delete.php @@ -0,0 +1,25 @@ +<?php +require '../config.php'; +require_once(TEMPLATES_PATH . "/header.php"); +require_once(TEMPLATES_PATH . "/panel.php"); +require_once(LIBRARY_PATH . "/functions.php"); + +if(session_set()) { +$conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db']['password']); +$query = $conn->prepare("DELETE FROM users WHERE id = :id"); +$query->bindParam(':id', $_SESSION['user_id']); + +if($query->execute()) { + echo '<h2>Account successfully deleted</h2>'; + unset($_SESSION['user_name']); + unset($_SESSION['user_id']); +} else { + echo '<h2>Account deletion failed</h2>'; +} +} + +header("Refresh: 2; URL={$config['urls']['base']}"); + +require_once(TEMPLATES_PATH . "/footer.php"); +?> + |