forked from landerssini/Php-Final-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
24 lines (20 loc) · 698 Bytes
/
delete.php
File metadata and controls
24 lines (20 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
include_once('./db.php');
class Delete extends Connection {
public function deleteUser($user){
$conexion = parent::connect();
if(isset($_POST["delete"])) {
$query = 'DELETE FROM users WHERE email = "'.$user.'"';
$check_query = mysqli_query($conexion, $query);
if($check_query) {
header("location: ./logout.php");
} else {
echo " Error, the user has not been deleted";
}
}
}
}
session_start();
$user = $_SESSION["currentEmail"];
$db = new Delete;
$db->deleteUser($user);