Repository navigation
Expand file tree
/
Copy pathdeleteadmin.php
More file actions
143 lines (126 loc) · 3.37 KB
/
Copy pathdeleteadmin.php
File metadata and controls
143 lines (126 loc) · 3.37 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
session_start();
include("connection.php");
$N=$_SESSION['admin'];
$row1=null;
if( isset($_GET['admin']) )
{
$admin = $_GET['admin'];
$res= mysqli_query($conn,"select*from adminlogin where admin='$admin'");
$row1= mysqli_fetch_array($res);
$r1 = implode(',',$row1);
}
if(isset($_POST['submit']))
{
$u=$_POST['admin'];
$p=$_POST['dadmin'];
$r=$_POST['dp'];
$query="select * from adminlogin where admin='$p' and password='$r'";
$results=mysqli_query($conn,$query);
$count=mysqli_num_rows($results);
if($count)
{
$_SESSION['admin']=$p;
$r=mysqli_fetch_row(mysqli_query($conn,"select*from adminlogin where admin='$u'"));
if(!empty($r))
{
mysqli_query($conn,"delete from adminlogin where admin='$u'");
echo "<script>alert('Successfully Removed Admin');window.location.href='viewadmin.php';</script>";
}
else
{
echo "<script>alert('Error!!');window.location.href='viewadmin.php';</script>";
}
mysqli_close($conn);
}
else
{
echo "<script>alert('You are not permitted to delete the admin');window.location.href='viewadmin.php';</script>";
}
}
?>
<html>
<head>
<title>delete admin</title>
<style>
body {
margin: 0;
padding: 0;
font-family: sans-serif;
background: url() no-repeat;
background-size: cover;
}
.login-box {
width: 280px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: ;
}
.login-box h1 {
float: left;
font-size: 40px;
border-bottom: 4px solid #191970;
margin-bottom: 50px;
padding: 13px;
}
.textbox {
width: 100%;
overflow: hidden;
font-size: 20px;
padding: 8px 0;
margin: 8px 0;
border-bottom: 1px solid #191970;
}
.fa {
width: px;
float: left;
text-align: center;
}
.textbox input {
border: none;
outline: none;
background: none;
font-size: 18px;
float: left;
margin: 0 10px;
}
.button {
width: 100%;
padding: 8px;
color: #ffffff;
background: none #191970;
border: none;
border-radius: 6px;
font-size: 18px;
cursor: pointer;
margin: 12px 0;
}
.login-box h1 {
float: left;
font-size: 40px;
border-bottom: 4px solid #191970;
margin-bottom: 50px;
padding: 13px;
}
</style>
</head>
<body>
<form action='deleteadmin.php' method='post'>
<div class="login-box">
<h1>Delete admin</h1>
<div class='textbox'>
<input type='text' name='admin' placeholder='Admin' value='<?php echo $row1[0]; ?>'>
</div>
<div class='textbox'>
<input type='text' name='dadmin' placeholder='Current admin'>
</div>
<div class='textbox'>
<input type='password' name='dp' placeholder='Current admin password'>
</div>
<input class='button' type='submit' name='submit' value='Delete'>
</div>
</form>
</body>
</html>