-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
26 lines (22 loc) · 920 Bytes
/
Copy pathdelete.php
File metadata and controls
26 lines (22 loc) · 920 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
25
26
<?php
//Get users session
//session_start() creates a session or resumes the current one based on a
//session identifier passed via a GET or POST request, or passed via a cookie.
session_start();
//include the database connection
require_once 'includes/connection.php';
$name = $_SESSION['name'];
$email = $_SESSION['email'];
//sql query for deleting the a particular user from the 'users' table in PHPMyAdmin
$sql_query = ("DELETE FROM users WHERE fullname='$name'");
$result = mysqli_query($conn, $sql_query);
//If the sql query happens, the user has been deleted and is sent back to logout.php file
//The logout.php file will close the session and send them to the index.html page
if($sql_query){
header("Location: logout.php");
} else {
//If the above doesn't work I've put a mysql_error with the database connection sql
//variable as a paramete
mysql_error($onn);
}
?>