-
Notifications
You must be signed in to change notification settings - Fork 1
/
delete_account.php
96 lines (80 loc) · 3.24 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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="profile.css">
</head>
<body>
<table class="table">
<?php
session_start();
include "SQL_connection.php";
$idmail="";
$mail="";
$username="";
$admin="";
$counter=1;
$usr=$_SESSION['user'];
include('isadmin.php');
if($printadmins){
$query = "SELECT * FROM accounts";
$result = mysqli_query($link,$query);
$num= mysqli_num_rows($result);
echo '<thead>
<tr>
<th style = "font-size:16px;" scope="col">No.</th>
<th style = "font-size:16px;" scope="col">Email</th>
<th style = "font-size:16px;" scope="col">Username</th>
<th style = "font-size:16px;" scope="col">Admin</th>
<th style = "font-size:16px;" scope="col">Delete</th>
</tr>
</thead>
<tbody>' ;
while($row = mysqli_fetch_array($result)){
$mail=$row['Email'];
$username=$row['Username'];
$admin=$row['isadmin'];
echo '<tr>
<td> <label style = "font-size:14px;">'; echo $counter; echo '</label></td>';
echo '<td> <label style = "font-size:14px;">'; echo $mail; echo '</label></td>';
echo '<td> <label style = "font-size:14px;">'; echo $username; echo '</label></td>';
if($admin==1){
echo '<td> <label style = "font-size:14px;">'; echo 'True'; echo '</label></td>';
}else{
echo '<td> <label style = "font-size:14px;">'; echo 'False'; echo '</label></td>';
}
echo '<td> <a href="delete_function.php?username='; echo $username; echo' ">Delete</a></td>
</tr>' ;
$counter= $counter +1;
}
echo '</tbody>' ;
}else{
$queryuser = "SELECT * FROM accounts WHERE Username='$usr'";
$resultuser = mysqli_query($link,$queryuser);
$numuser= mysqli_num_rows($resultuser);
echo '<thead>
<tr>
<th style = "font-size:16px;" scope="col">No.</th>
<th style = "font-size:16px;" scope="col">Email</th>
<th style = "font-size:16px;" scope="col">Username</th>
<th style = "font-size:16px;" scope="col">Delete</th>
</tr>
</thead>
<tbody>' ;
while($row = mysqli_fetch_array($resultuser)){
$mail=$row['Email'];
$username=$row['Username'];
echo '<tr>
<td> <label style = "font-size:14px;">'; echo $counter; echo '</label></td>';
echo '<td> <label style = "font-size:14px;">'; echo $mail; echo '</label></td>';
echo '<td> <label style = "font-size:14px;">'; echo $username; echo '</label></td>';
echo '<td> <a href="delete_function.php?username='; echo $username; echo '">Delete</a></td>
</tr>' ;
$counter= $counter +1;
}
echo '</tbody>' ;
}
mysqli_close($link);
?>
</table>
</body>
</html>