-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction_user.php
42 lines (30 loc) · 1.25 KB
/
action_user.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
Session_start();
if(!isset($_SESSION['loggedin']) || $_SESSION['user_role'] != 0){
header('location:404.php');
}
if(isset ($_GET['action'])){
$delete = $_GET['action'];
$user_id = $_GET['id'];
$admin_id = $_SESSION['u-id'];
if ($delete == 'delete'){
if($user_id == $admin_id){
$_SESSION['msg'] = "<strong class='text-danger'> You can not delete admin/your data </strong>";
header('location:admin-form.php');
}else{
include_once 'db_connection.php';
$conn=connection();
$sql = "DELETE FROM users_details WHERE id='$user_id' ";
if($conn->query($sql)){
$_SESSION['msg'] = "<strong class='text-success'> Remove Table Data Successfully </strong>";
header('location:admin-form.php');
}else{
$_SESSION['msg'] = "<strong class='text-danger'> Invailed Data </strong>";
header('location:admin-form.php');
}
}
}else{
header('location:404.php');
}
}
?>