-
Notifications
You must be signed in to change notification settings - Fork 0
/
panel.php
292 lines (288 loc) · 11.4 KB
/
panel.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
<?php
include 'includes/config.php';
include 'includes/header.php';
/* UCP User klasa */
require_once 'classes/ucp_user.class.php';
$ucp_user = new User();
/* Provjera da li je logovan */
if(!$ucp_user->IsLogged())
{
header('location: index.php');
exit();
}
/* Provjera da li je banovan */
if($ucp_user->IsBanned($_SESSION['username']))
{
session_destroy();
header('location: index.php');
exit();
}
/* Proces updejt profila */
if(isset($_POST['settings_submit']))
{
if(empty($_POST['email']))
$_SESSION['error_msg'] = "Niste upisali email adresu!";
else if(empty($_POST['tpassword']))
$_SESSION['error_msg'] = "Niste upisali trenutnu sifru!";
else if(empty($_POST['npassword']))
$_SESSION['error_msg'] = "Niste upisali novu sifru!";
else if(empty($_POST['sig_pitanje']))
$_SESSION['error_msg'] = "Niste upisali sigurnosno pitanje!";
else if(empty($_POST['sig_odgovor']))
$_SESSION['error_msg'] = "Niste upisali odgovor na sigurnosno pitanje!";
else if(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
$_SESSION['error_msg'] = "Email adresu koju ste upisali nije validna!";
else if(!preg_match('/\.(jpg|jpeg|png|gif|svg)(?:[\?\#].*)?$/i', $_POST['avatar'], $matches))
$_SESSION['error_msg'] = "URL Avatara koji ste unijeli nije u formatu .png, .jpg, .jpeg, .svg ili .gif!";
else
$ucp_user->UpdateProfile(
$_POST['email'],
$_SESSION['username'],
$_POST['tpassword'],
$_POST['npassword'],
$_POST['sig_pitanje'],
$_POST['sig_odgovor'],
$_POST['avatar']
);
}
/* Proces updejt max_karaktera */
if(isset($_POST['settings_maxkaraktera']))
{
if(empty($_POST['max_characeters']))
$_SESSION['error_msg'] = "Niste upisali broj max. karaktera!";
else
$ucp_user->UpdateSettings($_SESSION['username'], 'max_characters', $_POST['max_characeters']);
}
/* Proces obavijesti */
if(isset($_POST['obavijest_submit']))
{
if(empty($_POST['obavijest_naslov']))
$_SESSION['error_msg'] = "Niste upisali naslov obavijesti!";
else if(empty($_POST['obavijest_text']))
$_SESSION['error_msg'] = "Niste upisali text obavijesti!";
else
$ucp_user->CreateAnnouncement($_SESSION['username'], $_POST['obavijest_naslov'], $_POST['obavijest_text']);
}
/* Proces banovanja */
if(isset($_POST['ban']))
{
if(empty($_POST['ban_id']))
$_SESSION['error_msg'] = "Niste unijeli korisnika kojeg zelite banovati!";
else if(empty($_POST['ban_reason']))
$_SESSION['error_msg'] = "Niste unijeli razlog bana!";
else
$ucp_user->Ban($_SESSION['username'], $_POST['ban_id'], $_POST['ban_reason']);
}
/* Proces unbanovanja */
if(isset($_POST['unban']))
{
if(empty($_POST['unban_id']))
$_SESSION['error_msg'] = "Niste unijeli korisnika kojeg zelite unbanovati!";
else
$ucp_user->UnBan($_SESSION['username'], $_POST['unban_id']);
}
?>
<div class="under-cover">
<?php
if($ucp_user->IsLogged())
{
?>
<div id="login-place" class="login-place">
<a href="?page=admin-panel"><div class="button">Admin Panel</div></a>
<a href="?page=settings"><div class="button">Podesavanja</div></a>
<a href="logout.php"><div style="background: #bb0000;" class="button">Logout</div></a>
</div>
<div class="greetings">Pozdrav <a href="#"><b><?php echo $_SESSION['username']; ?></b></a>, dobrodosli na korisnicki panel.</div>
</div>
<?php
}
?>
<?php if(isset($_SESSION['error_msg'] )){?>
<?php echo '<div class="box-alert">'.$_SESSION['error_msg'] .'</div>';unset($_SESSION['error_msg']);?>
<?php } ?>
<?php if(isset($_SESSION['success_msg'] )){?>
<?php echo '<div class="box-success">'.$_SESSION['success_msg'] .'</div>';unset($_SESSION['success_msg']);?>
<?php } ?>
<div class="main-content">
<?php
if(empty($_GET['page']))
{
?>
<div class="info-box">
<img class="skin-box" src="assets/images/skinovi/21.png"/>
<div class="info-holder">
<span class="info-title">Statistika</span>
<p class="info-text">Pol: <b>Musko</b><br>Datum rodjenja: <b>11.06.1992 (24 godine)</b><br>Poreklo: <b>Los Angeles, CA</b><br>Telefon: <b>Da (665437)</b><br>Posao: <b>Gradjevinar</b><br>Vencan: <b>Da - Nicole Parker</b><br>Organizacija: <b>/</b><br></p>
</div>
<div class="info-holder">
<span class="info-title">Imovina</span>
<p class="info-text">Novac: <b>9400$</b><br>Bankovni racun: <b>50000$</b><br>Stedna knjizica: <b>1400000$</b><br>Plata: <b>13000$</b><br>Kuca: <b>Hollywood Hills, 34</b><br>Biznis: <b>NIGHT CLUB 'Octopuss', 61</b><br>Stan: <b>Ne poseduje</b><br></p>
</div>
<div class="info-holder">
<span class="info-title">Vozila</span>
<p class="info-text">Vozila 1: <b>Sultan (1135)</b><br>Vozilo 2: <b>Nevada (1146)</b><br>Vozilo 3: <b>Tropic (1182)</b><br>Vozilo 4: <b>Ne poseduje</b><br>DODAVACE SE SLOTOVI<br></p>
</div>
<div class="info-holder">
<span class="info-title">OOC Stats</span>
<p class="info-text">Email: <b>zekirija2001@hotmail.com</b><br>Level: <b>5</b><br>Respekti: <b>26 / 40</b><br>Sati igre: <b>88</b><br>Zadnji put vidjeni: <b>27.08.2016 - 17:32</b><br>Pozicija: <b>Admin 6(Owner)</b><br>Donator Rank: <b>Nema</b></p>
</div>
</div>
<div class="info-box">
<span class="info-title">Oruzije</span><br><br>
<center>
<img src="assets/images/oruzija/weapon-0.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-4.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-3.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-2.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-1.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-0.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-0.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-0.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-0.png" width="75" height="75"/>
<img src="assets/images/oruzija/weapon-0.png" width="75" height="75"/>
</center>
</div>
<fieldset class="place">
<legend class="place-title">SIGNATURA</legend>
<center><img src="assets/images/signature-1.png"/></center><br>
<center><img src="assets/images/signature-2.png"/></center>
</fieldset>
<?php
}
else if($_GET['page'] == 'settings')
{
?>
<div class="info-box">
<h2>PODESAVANJE RACUNA</h2>
<form id="register-place" class="login-place" method="POST">
<div class="register-holder">
<label for="avatar">Profilna slika</label><br>
<input type="text" id="avatar" name="avatar" placeholder="Unesite link (.png, .gif, .jpg)"><br>
<img style="margin-top: 5px;" src="<?php echo $ucp_user->GetAvatarURL($_SESSION['username']);?>" width="50" height="50"/>
</div>
<div class="register-holder">
<label for="email">Email</label><br>
<input type="email" id="email" name="email" value="<?php echo $ucp_user->GetEmail($_SESSION['username']);?>" required="required"><br>
</div>
<div class="register-holder">
<label for="sig_pitanje">Sigurnosno pitanje</label><br>
<input type="text" id="sig_pitanje" name="sig_pitanje" value="<?php echo $ucp_user->GetSecretQuestion($_SESSION['username']);?>" required="required"><br>
</div>
<div class="register-holder">
<label for="sig_odgovor">Odgovor na sigurnosno pitanje</label><br>
<input type="text" id="sig_odgovor" name="sig_odgovor" value="<?php echo $ucp_user->GetSecretAnswer($_SESSION['username']);?>" required="required"><br>
</div>
<div class="register-holder">
<label for="tpassword">Nova sifra</label><br>
<input type="password" id="npassword" name="npassword" placeholder="Nova sifra" required="required"><br>
</div>
<div class="register-holder">
<label for="tpassword">Trenutna sifra</label><br>
<input type="password" id="tpassword" name="tpassword" placeholder="Potvrdite trenutnu sifru" required="required"><br>
</div>
<div class="register-holder">
<input type="submit" name="settings_submit" value="Sacuvaj">
</div>
</form>
<table class="server-info">
<thead>
<tr>
<th><b>Date</b></th>
<th><b>Adress</b></th>
</tr>
</thead>
<tbody>
<?php foreach($ucp_user->LastLoginLog($_SESSION['username']) as $log) { ?>
<tr>
<td><?php echo $log['date'];?></td>
<td><?php echo $log['ip'];?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php
}
else if($_GET['page'] == 'admin-panel')
{
if(!$ucp_user->IsAdmin($_SESSION['username']))
{
header('location: panel.php');
exit();
}
?>
<div class="info-box">
<h2>ADMINISTRATORSKI PANEL</h2>
<form class="login-place" method="POST">
<div class="register-holder">
<label for="max_characeters">Maksimalno Karaktera</label><br>
<input type="text" id="max_characeters" name="max_characeters" value="<?php echo $ucp_user->GetSettingsValue("max_characters");?>" required="required"><br>
</div>
<div class="register-holder">
<input type="submit" name="settings_maxkaraktera" value="Sacuvaj">
</div>
</form>
<form class="login-place" method="POST">
<div class="register-holder">
<label for="obavijest_naslov">Naslov obavijesti</label><br>
<input type="text" id="obavijest_naslov" name="obavijest_naslov" required="required"><br>
<label for="obavijest_text">Tekst obavijesti</label><br>
<textarea rows="4" cols="50" id="obavijest_text" name="obavijest_text" required="required">
</textarea>
</div>
<div class="register-holder">
<input type="submit" name="obavijest_submit" value="Posalji">
</div>
</form>
<form class="login-place" method="POST">
<div class="register-holder">
<label for="ban_id">Banuj</label><br>
<select name="ban_id">
<?php
foreach($ucp_user->GetAllUsers() as $user)
{
?>
<option value="<?php echo $user['id'];?>"><?php echo $user['username'];?></option>
<?php
}
?>
</select><br>
<label for="ban_reason">Razlog</label><br>
<input type="text" id="ban_reason" name="ban_reason" required="required"><br>
</textarea>
</div>
<div class="register-holder">
<input type="submit" name="ban" value="Posalji">
</div>
</form>
<form class="login-place" method="POST">
<div class="register-holder">
<label for="unban_id">Unbanuj</label><br>
<select id="unban_id" name="unban_id">
<?php
foreach($ucp_user->GetAllBannedUsers() as $user)
{
?>
<option value="<?php echo $user['id'];?>"><?php echo $user['username'];?></option>
<?php
}
?>
</select><br>
</textarea>
</div>
<div class="register-holder">
<input type="submit" name="unban" value="Posalji">
</div>
</form>
</div>
<?php
}
?>
</div>
<div class="footer">
<center><img class="logo" src="assets/images/logo-1.gif"/></center>
<span class="credits-text">© Copyright <?php echo date("Y"); ?> - All rights reserved - Designed and coded by <a href="#">Zekiloni</a></span>
<!--<span class="time"><?php //echo date("H:i"); ?></span> -->
</div>
</div>
</body>