-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay-stdorg.php
223 lines (184 loc) · 4.29 KB
/
display-stdorg.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
<?php
session_start();
include_once 'dbConn.php';
include_once 'h-admin.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Stadium Organiser</title>
<style type="text/css">
body{
margin:0px;
padding: 0px;
font-family: sans-serif;
}
.new{
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.add-new-product{
width: 800px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
}
.add-new-product img{
margin-top: 5px;
height: 30px;
width: 30px;
}
.add-new-product a{
display: flex;
flex-direction: row-reverse;
text-decoration: none;
color: white;
}
.add-label{
border-radius: 10px;
margin-left: -10px;
text-align: center;
padding: 10px;
background-color: #6abd7a;
}
.all-item{
margin: 50px;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.item{
width: 800px;
border: 1px solid gray;
border-radius: 10px;
display: flex;
flex-direction: row;
padding: 10px;
}
.item-img img{
width: 100px;
height: 100px;
}
.item-desc-price-quantity{
width: 350px;
margin: 15px 30px;
}
.item-desc, .item-price, .item-quantity{
margin-top: 10px;
}
.item-update{
margin: 20px 5px;
}
.input-num{
border-radius: 10px;
text-align: center;
margin-top: 5px;
border: 1px solid gray;
width: 180px;
height: 30px;
}
.button-submit{
border: 1px transparent;
box-shadow: 0px 0px 5px lightgray;
border-radius: 10px;
height: 30px;
width: 100px;
margin-top: 5px;
margin-left: 40px;
background-color: #6abd7a;
color: white;
}
.button-submit a{
color: white;
}
.button-delete a{
color:white;
}
.button-delete{
border: 1px transparent;
box-shadow: 0px 0px 5px lightgray;
border-radius: 10px;
height: 30px;
width: 100px;
margin-top: 5px;
margin-left: 40px;
background-color: #f71735;
color: white;
}
.button-delete:hover{
background-color: #42cef5;
box-shadow: 0px 0px 5px black;
}
.button-submit:hover{
background-color: #42cef5;
box-shadow: 0px 0px 5px black;
}
</style>
</head>
<body>
<div class="title-page">
<center><h1>STADIUM ORGANIZER</h1></center>
</div>
<div class="new">
<div class="add-new-product">
<div class="add-button">
<a href="addStadiumOrg.php">
<div class="add-label">Add New Stadium Organizer</div>
<img src="image/add.png">
</a>
</div>
</div>
</div>
<div class="update-form">
<?php
$class_items = "SELECT * FROM user WHERE role='StdOrg';";
$result = mysqli_query($conn, $class_items);
while ($record = mysqli_fetch_assoc($result)) {
?>
<div class="all-item">
<div class="item">
<div class="item-img">
<img src="https://img.icons8.com/pastel-glyph/64/000000/person-male.png"/>
</div>
<div class="item-desc-price-quantity">
<div>Username : <?php echo $record['username']; ?></div>
<div class="item-desc">Email : <?php echo $record['email']; ?></div>
<div class="item-desc">Address : <?php echo $record['address']; ?></div>
<div class="item-desc">Phone : <?php echo $record['phone']; ?></div>
<?php
$stadium_id = $record['stadiumID'];
$sql = "SELECT stadiumName FROM stadium WHERE stadiumID = '$stadium_id';";
$res = mysqli_query($conn,$sql);
while($row = mysqli_fetch_assoc($res)){
?>
<div class="item-desc">From <?php echo $row['stadiumName']; ?></div>
<?php break;} ?>
</div>
<div class="item-update">
<br><button type="submit" class="button-submit"><a href="update-stdorg.php?username=<?php echo $record['username']; ?>">Update</a></button>
<button type="submit" class="button-delete"><a href="display-stdorg.php?action=delete&username=<?php echo $record['username']; ?>">Delete</a></button>
</div>
</div>
</div>
<?php
}
?>
</div>
</body>
</html>
<?php
if(isset($_GET['action'])){
if($_GET['action'] == "delete"){
$user = $_GET['username'];
$sql = "DELETE FROM user WHERE username = '$user';";
$res = mysqli_query($conn,$sql);
if($res > 0)
{
echo "<script>alert('Stadium Organiser successfully deleted');";
echo "window.location.href = 'display-stdorg.php';</script>";
}
}
}
?>