-
Notifications
You must be signed in to change notification settings - Fork 1
/
profile.php
322 lines (271 loc) · 10.1 KB
/
profile.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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?php
include 'admin/configuration.php';
session_start();
//Check if user is not logged and he's requesting for Noone!
if (!islogged() && empty($_GET['user'])) {
die("<script>window.history.back()</script>");
}
//Connect
$con = db_connect();
if ($con->connect_errno) {
return;
}
//Check if user want to get another user's profile or his own
if (!empty($_GET['user'])) {
$user = htmlspecialchars($_GET['user']);
} else {
$user = $_SESSION['userid'];
}
//Upgrade user
if (isset($_POST['upgrade']) && $_POST['upgrade'] == 1 && $_SESSION['role'] == 2) {
// SQL query to fetch information of user.
$sql = $con->prepare('UPDATE user set upgrade=1 WHERE Username=?');
$sql->bind_param('s', $user);
$sql->execute();
}
// SQL query to fetch information of user.
$sql = $con->prepare('SELECT * FROM user WHERE Username= ?');
$sql->bind_param('s', $user);
$sql->execute();
$result = $sql->get_result();
$num_row = mysqli_num_rows($result);
if ($num_row == 1) {
//Fetch all user's information
$row = mysqli_fetch_array($result);
$username = $row['Username'];
$fname = $row['FirstName'];
$lname = $row['LastName'];
$tel = $row['Tel'];
$mail = $row['Mail'];
$sex = $row['Sex'];
$Upgrade = $row['Upgrade'];
$birthday = $row['Birthday'];
if ($row['Role'] == 0) {
$role = "Διαχειριστής";
} else if ($row['Role'] == 1) {
$role = "Μάνατζερ";
} else {
$role = "Χρήστης";
}
$image = $row['Image'];
//Εδώ πρέπει να παρθούν και άλλες πληροφορίες δημοπρασίες hoteliers κτλ
} else {
//Returns error that page not found
die(include '404.php');
}
function ownsProfile()
{
if (islogged() && $_SESSION['userid'] == $GLOBALS['user']) {
return true;
}
return false;
}
?>
<!DOCTYPE html>
<html>
<head lang="en">
<?php
$Page_Title = "Προφίλ - " . $user;
include 'head.php';
?>
<!--CSS-->
<link href="css/star-rating.min.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
<!--Scripts-->
<script src="js/star-rating.min.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script src=js/profilescripts.js></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<style>
.tabregion {
display: none;
}
.hidden_form_s_1 {
display: none;
}
.hidden_form_s_8 {
display: none;
}
.hidden_form_s_14 {
display: none;
}
.hidden_form_s_15 {
display: none;
}
.PaginAuctionsHiEd {
display: none;
}
.detailshead {
font-weight: bold;
font-size: 20px;
}
.detailsbody_s_1 {
font-size: 20px;
}
.detailsbody_s_8 {
font-size: 20px;
}
.detailsbody_s_14 {
font-size: 20px;
}
.detailsbody_s_15 {
font-size: 20px;
}
</style>
</head>
<body class="white" onload="CurrentTab();
<?php if (isRole("admin") || isRole("hotelier")) {
echo "PaginAuctionsHistory(0);";
echo "Paginate('PaginationNumHotel_', 'ElementOFHotelList', 'HotelPaginationList',0);";
echo "Paginate('PaginationNumEditUsers_', 'ElementOFEditUsers_', 'EditUsersPaginationList',0);";
}
if (isRole("hotelier")) {
echo "Paginate('PaginationNumEvalUser_', 'ElementOFUserEvaluation', 'UserEvalPaginationList',0);";
}
if (isRole("user")) {
echo "Paginate('PaginationNumUserHistory_', 'ElementOFUserHistory', 'UserHistoryPaginationList', 0);";
echo "Paginate('PaginationNumHotelEval_', 'ElementOFHotelEvaluation', 'HotelEvalPaginationList', 0);";
} ?>
">
<!--Navigation Menu-->
<?php
include 'header.php';
?>
<!--Navigation Menu-->
<div class="row container" style="padding-top: 60px">
<!--Tab Panels-->
<div class="col s12 m4">
<div class="center-align col s12 m12">
<img id="img_prof" onclick="rotate('img_prof')"
class=" circle responsive-img z-depth-1 grey lighten-3" style="padding: 5px"
src="<?php echo $image; ?>">
</div>
<div class="col s12 m12">
<ul class="collapsible popout" data-collapsible="accordion">
<li>
<a class="collapsible-header active mytab" id="mytab_1" href="#gomytab_1"><i
class="mdi-action-perm-contact-cal"></i>Πληροφορίες</a>
<?php
if (ownsProfile()) {
?>
<div class="collapsible-body"><p>Επεξεργαστείτε προσωπικές πληροφορίες.</p></div>
<?php }
?>
</li>
<li>
<a class="collapsible-header mytab"><i class="mdi-social-notifications-on"></i>Δημοπρασίες</a>
<div class="collapsible-body collection">
<?php
if ((isRole("admin") || isRole("hotelier")) && ownsProfile()) {
?>
<a href="#gomytab_4" class="collection-item mytab" id="mytab_4">Δημιουργία</a>
<a href="#gomytab_2" class="collection-item mytab" id="mytab_2">Επεξεργασία</a>
<?php
}
if (isRole("hotelier") && ownsProfile()) {
?>
<a href="#gomytab_3" class="collection-item mytab" id="mytab_3">Βαθμολόγηση</a>
<?php
}
if (isRole("user") && ownsProfile()) {
?>
<a href="#gomytab_11" class="collection-item mytab" id="mytab_11">Ιστορικό</a>
<a href="#gomytab_10" class="collection-item mytab" id="mytab_10">Βαθμολόγηση</a>
<?php }
?>
</div>
</li>
<li>
<li>
<?php
if (ownsProfile() && (isRole("admin") || isRole("hotelier"))) {
?>
<a class="collapsible-header mytab" id="mytab_6"><i class="mdi-maps-hotel"></i>Ξενοδοχεία</a>
<div class="collapsible-body collection">
<a href="#gomytab_5" class="collection-item mytab" id="mytab_5">Δημιουργία</a>
<a href="#gomytab_9" class="collection-item mytab" id="mytab_9">Επεξεργασία</a>
</div>
<?php }
?>
</li>
<li>
<?php
if (ownsProfile() && isRole("admin")) {
?>
<a class="collapsible-header mytab" id="mytab_6"><i class="mdi-social-people"></i>Χρήστες</a>
<div class="collapsible-body collection">
<a href="#gomytab_13" class="collection-item mytab" id="mytab_13">Δημιουργία</a>
<a href="#gomytab_12" class="collection-item mytab" id="mytab_12">Επεξεργασία</a>
</div>
<?php }
?>
</li>
<?php
if (isRole("user")) {
?>
<li>
<a class="collapsible-header mytab" id="mytab_6" href="#gomytab_6"><i
class="mdi-social-person-add"></i>Aναβάθμιση</a>
</li>
<?php
}
if (ownsProfile()) {
?>
<li>
<a class="collapsible-header mytab" href="#gomytab_7" id="mytab_7"><i
class="mdi-action-delete"></i>Διαγραφή</a>
</li>
<?php
}
?>
</ul>
</div>
</div>
<!--Tab Panels-->
<?php
//User Details
include 'profile/sections/user_details.php';
//Auctions History/Edit
include 'profile/sections/auctions_history_edit.php';
//Users evaluation
include 'profile/sections/users_evaluation.php';
if (ownsProfile()) {
if ((isRole("admin") || isRole("hotelier"))) {
//Auction Create
include 'profile/sections/auction_create.php';
//Hotel Create
include 'profile/sections/hotel_create.php';
//Hotel Details
include 'profile/sections/hotel_details.php';
//Auction Details
include 'profile/sections/auction_details.php';
//Auctionσ Edit
include 'profile/sections/hotels_edit.php';
}
if (isRole("user")) {
//Upgrade user
include 'profile/sections/upgrade_user.php';
//Hotel evaluation
include 'profile/sections/hotel_evaluation.php';
//Auctions History/Edit
include 'profile/sections/auctions_history_edit.php';
//Auctions History
include 'profile/sections/auctions_history.php';
}
if (isRole("admin")) {
//User Edit
include 'profile/sections/user_edit.php';
}
//Use Delete
include 'profile/sections/user_delete.php';
//User Create
include 'profile/sections/user_create.php';
}
?>
<!--Tab Panels-->
</div>
<?php
include 'footer.php';
?>
</body>
</html>