-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete-account.php
300 lines (264 loc) · 11 KB
/
delete-account.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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<?php
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if (strlen($_SESSION['smaid'] == 0)) {
header('location:logout.php');
} else {
?>
<!doctype html>
<html class="no-js" lang="en">
<head>
<title>Delete Account | Smart Farming System</title>
<!-- Bootstrap CSS
============================================ -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Bootstrap CSS
============================================ -->
<link rel="stylesheet" href="css/font-awesome.min.css">
<!-- adminpro icon CSS
============================================ -->
<link rel="stylesheet" href="css/adminpro-custon-icon.css">
<!-- meanmenu icon CSS
============================================ -->
<link rel="stylesheet" href="css/meanmenu.min.css">
<!-- mCustomScrollbar CSS
============================================ -->
<link rel="stylesheet" href="css/jquery.mCustomScrollbar.min.css">
<!-- animate CSS
============================================ -->
<link rel="stylesheet" href="css/animate.css">
<!-- normalize CSS
============================================ -->
<link rel="stylesheet" href="css/data-table/bootstrap-table.css">
<link rel="stylesheet" href="css/data-table/bootstrap-editable.css">
<!-- normalize CSS
============================================ -->
<link rel="stylesheet" href="css/normalize.css">
<!-- charts CSS
============================================ -->
<link rel="stylesheet" href="css/c3.min.css">
<!-- style CSS
============================================ -->
<link rel="stylesheet" href="style.css">
<!-- responsive CSS
============================================ -->
<link rel="stylesheet" href="css/responsive.css">
<!-- modernizr JS
============================================ -->
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
<script src="js/vendor/jquery-1.11.3.min.js"></script>
</head>
<body class="materialdesign">
<div class="wrapper-pro">
<?php include_once('includes/sidebar.php'); ?>
<?php include_once('includes/header.php'); ?>
<!-- Breadcome start-->
<div class="breadcome-area mg-b-30 small-dn">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="breadcome-list shadow-reset">
<div class="row">
<div class="col-lg-12">
<ul class="breadcome-menu">
<li><a href="dashboard.php">Home</a> <span class="bread-slash">/</span>
</li>
<li><span class="bread-blod">Delete Admin Account</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Breadcome End-->
<!-- Static Table Start -->
<div class="data-table-area mg-b-15">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="sparkline13-list shadow-reset">
<div class="sparkline13-hd">
<div class="main-sparkline13-hd">
<h1>Delete <span class="table-project-n"></span> User Accounts</h1>
<div class="sparkline13-outline-icon">
<span class="sparkline13-collapse-link"><i class="fa fa-chevron-up"></i></span>
<span><i class="fa fa-wrench"></i></span>
<span class="sparkline13-collapse-close"><i class="fa fa-times"></i></span>
</div>
</div>
</div>
<div class="sparkline13-graph">
<div class="datatable-dashv1-list custom-datatable-overright">
<form action="" method="post">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Admin's ID</th>
<th>Admin Name</th>
<th>Admin Email</th>
<th>Admin Username</th>
<th>Phone Number</th>
<th>Registration Date</th>
<th style="border-right-style: hidden; border-bottom-style: hidden; border-top-style: hidden"></th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM admin ORDER BY ID ASC";
// $_SESSION['editplant']=$_POST['searchdata'];
$query = $Conn->query($sql);
$cnt = 1;
if ($query->num_rows > 0) {
while ($row = $query->fetch_assoc()) {
// {
?>
<tr>
<td><?php echo $row['ID']; ?></td>
<td><?php echo $row['Admin_name']; ?></td>
<td><?php echo $row['Admin_email']; ?></td>
<td><?php echo $row['Admin_username']; ?></td>
<td><?php echo $row['Phone_number']; ?></td>
<td><?php echo $row['Registration_date']; ?></td>
<td style="border-right-style: hidden; border-bottom-style: hidden; border-top-style: hidden"><button type="button" value="<?php echo $row['ID'] ?>" style="background:black; color:white" name="Delete" class="btn btn-primary "><i class="fa fa-trash" aria-hidden="true"></i> Delete</button></td>
</tr>
</tbody>
<?php
$cnt = $cnt + 1;
}
}
?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="delete">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title"><b>Deleting...</b></h4>
</div>
<div class="modal-body">
<form class="form-horizontal" action="">
<input type="hidden" class="adminid" name="adminid">
<div class="text-center">
<p>DELETE ADMIN ACCOUNT</p>
<h2 class="bold fullname"></h2>
</div>
<div></div>
</div>
<div class="modal-footer">
<button type="button" style="background:black; color:white" class="btn btn-default btn-flat pull-left" data-dismiss="modal"><i class="fa fa-close"></i> Close</button>
<button type="button" style="background:black; color:white" data-id="<?php echo $ids; ?>" id="Delete" class="btn btn-danger btn-flat deleteadmin" name="delete"><i class="fa fa-trash"></i> Delete</button>
</form>
</div>
</div>
</div>
</div>
<!-- Modal ends -->
</form>
<!-- Static Table End -->
</div>
</div>
<script>
</script>
<!-- jquery
============================================ -->
<script>
$(document).ready(function() {
$('button').click(function(e) {
e.preventDefault();
$('#delete').modal('show');
var id = $(this).val();
// data('id');
getRow(id);
});
});
$(document).ready(function() {
$('#Delete').click(function(e) {
e.preventDefault();
var id = $(this).val();
deleteRow(id);
});
});
function deleteRow(id) {
$.ajax({
type: 'POST',
url: 'admin_delete.php',
data: {
id: id
},
dataType: 'json',
success: function() {
document.location = 'delete-account.php';
}
})
}
function getRow(id) {
$.ajax({
type: 'POST',
url: 'admin_row.php',
data: {
id: id
},
dataType: 'json',
success: function(response) {
$('.fullname').html(response.Admin_name);
$('.adminid').html(response.ID);
$('.deleteadmin').val(response.ID);
}
});
}
</script>
<!-- bootstrap JS
============================================ -->
<script src="js/bootstrap.min.js"></script>
<!-- meanmenu JS
============================================ -->
<script src="js/jquery.meanmenu.js"></script>
<!-- mCustomScrollbar JS
============================================ -->
<script src="js/jquery.mCustomScrollbar.concat.min.js"></script>
<!-- sticky JS
============================================ -->
<script src="js/jquery.sticky.js"></script>
<!-- scrollUp JS
============================================ -->
<script src="js/jquery.scrollUp.min.js"></script>
<!-- counterup JS
============================================ -->
<script src="js/counterup/jquery.counterup.min.js"></script>
<script src="js/counterup/waypoints.min.js"></script>
<!-- peity JS
============================================ -->
<script src="js/peity/jquery.peity.min.js"></script>
<script src="js/peity/peity-active.js"></script>
<!-- sparkline JS
============================================ -->
<script src="js/sparkline/jquery.sparkline.min.js"></script>
<script src="js/sparkline/sparkline-active.js"></script>
<!-- data table JS
============================================ -->
<script src="js/data-table/bootstrap-table.js"></script>
<script src="js/data-table/tableExport.js"></script>
<script src="js/data-table/data-table-active.js"></script>
<script src="js/data-table/bootstrap-table-editable.js"></script>
<script src="js/data-table/bootstrap-editable.js"></script>
<script src="js/data-table/bootstrap-table-resizable.js"></script>
<script src="js/data-table/colResizable-1.5.source.js"></script>
<script src="js/data-table/bootstrap-table-export.js"></script>
<!-- main JS
============================================ -->
<script src="js/main.js"></script>
</body>
</html><?php } ?>