This repository has been archived by the owner on Dec 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.php
494 lines (432 loc) · 19 KB
/
index.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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<?php
$fichier = './inc/config.php';
if (file_exists($fichier) AND filesize($fichier ) > 0)
{
require_once ('inc/config.php');
require_once ('inc/fonctions.php');
require_once ('inc/radmin.php');
if ($themes) {require_once ('./inc/themes.php');}
if ($_GET['a'] == 'logout')
{
$_SESSION = array();
session_destroy();
session_unset();
header('Location: index.php');
}
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="img/favicon.ico">
<title>OpenSimulator Manager Web</title>
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" media="all" type="text/css" id="css" href="<?php echo $url; ?>" />
<link rel="stylesheet" href="css/btn3d.css" type="text/css" />
<link rel="stylesheet" href="css/login.css" type="text/css" />
<link rel="stylesheet" href="css/custom.css" type="text/css" />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
$('#myTab a').click(function (e) {e.preventDefault(); $(this).tab('show');})
$('#myTab a[href="#profile"]').tab('show')
$('#myTab a:first').tab('show')
$('#myTab a:last').tab('show')
$('#myTab li:eq(2) a').tab('show')
</script>
</head>
<body>
<div class="container">
<?php
// *********
// RECAPTCHA
// *********
if ($recaptcha && $_POST["g-recaptcha"])
{
include 'inc/recaptcha.php';
// The response from reCAPTCHA
$resp = null;
// The error code from reCAPTCHA, if any
$error = null;
$reCaptcha = new ReCaptcha($secret);
// Was there a reCAPTCHA response?
if ($_POST["g-recaptcha-response"])
{
$resp = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}
// If success
if ($resp != null && $resp->success)
{
// echo '<div id="alert" class="alert alert-success alert-dismissible" role="alert">Recaptcha success ...</div>';
}
else
{
echo '<div id="alert" class="alert alert-danger alert-dismissible" role="alert">Recaptcha failed!</div>';
$_SESSION = array();
session_unset();
}
}
// *********************************************************
// IDENTIFICATION ET INITIALISATION Variable OPENSIM[SELECT]
// *********************************************************
if (isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_POST['pass']))
{
$_SESSION['login'] = $_POST['firstname'].' '. $_POST['lastname'];
$auth = false;
$passwordHash = sha1($_POST['pass']);
// on se connecte a MySQL
$db = mysql_connect($hostnameBDD, $userBDD, $passBDD);
mysql_select_db($database,$db);
$sql = 'SELECT * FROM users';
$req = mysql_query($sql) or die('Erreur SQL !<p>'.$sql.'</p>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
if ($data['firstname'] == $_POST['firstname']
and $data['lastname'] == $_POST['lastname']
and $data['password'] == $passwordHash)
{
$auth = true;
$_SESSION['privilege'] = $data['privilege'];
$_SESSION['osAutorise'] = $data['osAutorise'];
$_SESSION['authentification']=true;
$_SESSION['zooming_select']=50;
break;
}
}
if ($auth == false)
{
echo '<div class="alert alert-danger alert-anim">'.$osmw_erreur_acces .'</div>';
header('Location: index.php?erreur=login');
}
else
{
// echo '<p>Bienvenue sur la page administration du site.</p>';
// on se connecte a MySQL
$db = mysql_connect($hostnameBDD, $userBDD, $passBDD);
mysql_select_db($database,$db);
$sql = 'SELECT * FROM moteurs';
$req = mysql_query($sql) or die('Erreur SQL!<p>'.$sql.'</p>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
$_SESSION['opensim_select'] = $data['id_os'];
break;
}
}
mysql_close();
}
?>
<?php if ($themes && isset($_SESSION['authentification'])): ?>
<!--Themes -->
<?php if ($_GET['style']) {$theme = $_GET['style'];} else $theme = "Templates"; ?>
<div class="btn-group">
<button type="button" class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="glyphicon glyphicon-leaf"></i> <?php echo $theme; ?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="index.php?style=default"><i class="glyphicon glyphicon-leaf"></i> default</a></i>
<li><a href="index.php?style=amelia"><i class="glyphicon glyphicon-leaf"></i> amelia</a></i>
<li><a href="index.php?style=cerulean"><i class="glyphicon glyphicon-leaf"></i> cerulean</a></i>
<li><a href="index.php?style=cosmo"><i class="glyphicon glyphicon-leaf"></i> cosmo</a></i>
<li><a href="index.php?style=cyborg"><i class="glyphicon glyphicon-leaf"></i> cyborg</a></i>
<li><a href="index.php?style=darkly"><i class="glyphicon glyphicon-leaf"></i> darkly</a></i>
<li><a href="index.php?style=flatly"><i class="glyphicon glyphicon-leaf"></i> flatly</a></i>
<li><a href="index.php?style=freelancer"><i class="glyphicon glyphicon-leaf"></i> freelancer</a></i>
<li><a href="index.php?style=journal"><i class="glyphicon glyphicon-leaf"></i> journal</a></i>
<li><a href="index.php?style=lumen"><i class="glyphicon glyphicon-leaf"></i> lumen</a></i>
<li><a href="index.php?style=paper"><i class="glyphicon glyphicon-leaf"></i> paper</a></i>
<li><a href="index.php?style=readable"><i class="glyphicon glyphicon-leaf"></i> readable</a></i>
<li><a href="index.php?style=sandstone"><i class="glyphicon glyphicon-leaf"></i> sandstone</a></i>
<li><a href="index.php?style=simplex"><i class="glyphicon glyphicon-leaf"></i> simplex</a></i>
<li><a href="index.php?style=slate"><i class="glyphicon glyphicon-leaf"></i> slate</a></i>
<li><a href="index.php?style=spacelab"><i class="glyphicon glyphicon-leaf"></i> spacelab</a></i>
<li><a href="index.php?style=superhero"><i class="glyphicon glyphicon-leaf"></i> superhero</a></i>
<li><a href="index.php?style=united"><i class="glyphicon glyphicon-leaf"></i> united</a></i>
<li><a href="index.php?style=yety"><i class="glyphicon glyphicon-leaf"></i> yety</a></i>
</ul>
</div>
<?php endif; ?>
<?php
if ($translator && isset($_SESSION['authentification']))
{
require_once ('./inc/translator.php');
echo('<div class="pull-right">');
include_once("./inc/flags.php");
echo('</div>');
}
?>
<div class="clearfix"></div>
<?php
// **********************
// PAGE EN ACCES SECURISE
// **********************
// Verification sur la session authentification
if (isset($_SESSION['authentification']))
{
// Si le moteur selectionne a change
if (isset($_POST['OSSelect'])){$_SESSION['opensim_select'] = trim($_POST['OSSelect']);}
// DISPLAY BOOTSTRAP MENU
include_once './inc/navbar.php';
?>
<?php
if ($_GET['a'])
{
$a = $_GET['a'];
/* index.php v5.5 */
if ($a == "1") {include('inc/GestSims.php');} // # Gestion sim v5.5 OK
if ($a == "2") {include('inc/GestSaveRegion.php');} // # Gestion backup sim v5.5 OK
if ($a == "3") {include('inc/GestTerrain.php');} // # Gestion Terrain v5.5 OK
if ($a == "4") {include('inc/GestInventaire.php');} // # Exporter un inventaire v5.5 OK
if ($a == "5") {include('inc/GestOpensim.php');} // admin // # Edition des fichiers de conf v5.5 OK
if ($a == "6") {include('inc/GestRegion.php');} // admin // # Gestion des Regions par moteur v5.5 OK
if ($a == "7") {include('inc/GestLog.php');} // # Gestion du Log v5.5 OK
if ($a == "8") {include('inc/GestUsers.php');} // # Gestion du compte utilisateur en cours v5.5 OK
if ($a == "9") {include('inc/GestContact.php');} // # Contact Utilisateur v5.5 OK
if ($a == "10") {include('inc/GestDirectory.php');} // # Gestion des Fichiers v5.5 OK
// if ($a == "11") {include('inc/xxxx.php');} // #
// if ($a == "12") {include('inc/xxxx.php');} // #
if ($a == "13") {include('inc/GestHelp.php');} // # Aide v5.5 OK
if ($a == "14") {include('inc/GestAbout.php');} // # Les remerciements v5.5 OK
if ($a == "15") {include('inc/GestAdminUsers.php');} // admin // # Gestion des utilisateurs v5.5 OK
//if ($a == "16") {include('inc/xxxx.php');} // #
if ($a == "17") {include('inc/GestSimulateur.php');} // admin // # Gestion des simulateurs v5.5 OK
if ($a == "18") {include('inc/GestConfig.php');} // admin // # Configuration de OSMW v5.5 OK
// if ($a == "19") {include('inc/xxx.php');} // #
if ($a == "20") {include('inc/GestNPC.php');} // # Gestion de NPC InWorld v6.0 OK
if ($a == "21") {include('inc/GestHypergrid.php');} // # Gestion des liens Hypergrid v5.5 OK
if ($a == "22") {include('inc/GestMap.php');} // # Map v5.5 OK
if ($a == "logout")
{
session_start();
$_SESSION = array();
session_unset();
header('Location: index.php');
}
}
else
{
// *******************
// AFFICHAGE PRINCIPAL
// *******************
echo Affichage_Entete($_SESSION['opensim_select']);
$moteursOK = Securite_Simulateur();
/* ************************************ */
//SECURITE MOTEUR
$btnN1 = "disabled";$btnN2 = "disabled";$btnN3 = "disabled";
if ($_SESSION['privilege'] == 4) {$btnN1 = ""; $btnN2 = ""; $btnN3 = "";} // Niv 4
if ($_SESSION['privilege'] == 3) {$btnN1 = ""; $btnN2 = ""; $btnN3 = "";} // Niv 3
if ($_SESSION['privilege'] == 2) {$btnN1 = ""; $btnN2 = "";} // Niv 2
if ($moteursOK == "OK" )
{
if($_SESSION['privilege'] == 1)
{$btnN1 = "";$btnN2 = "";$btnN3 = "";}
}
//SECURITE MOTEUR
/* ************************************ */
echo Select_Simulateur($_SESSION['opensim_select']);
?>
<?php if(isset($_SESSION['flash'])): ?>
<?php foreach($_SESSION['flash'] as $type => $message): ?>
<div class="alert alert-<?php echo $type; ?> alert-anim">
<?php echo $message; ?>
</div>
<?php endforeach; ?>
<?php unset($_SESSION['flash']); ?>
<?php endif; ?>
<?php
// **********
// TABS USERS
// **********
if (isset($_SESSION['authentification']) && $_SESSION['privilege']>= 3)
{
echo '<ul id="myTab" class="nav nav-pills">';
echo '<li class="active"><a href="#user" data-toggle="tab">'.$osmw_section_user.'</a></li>';
echo '<li ><a href="#admin" data-toggle="tab">'.$osmw_section_admin.'</a></li></ul>';
}
// echo '<br />';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">'.$osmw_menu_choix.'</h3>
</div>
<div class="panel-body">
<div class="tab-content">';
echo '<div class="tab-pane fade in active" id="user">';
echo '<p><a class="btn btn-default btn-block" href="?a=1">'.$osmw_index_1.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=2">'.$osmw_index_2.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=3">'.$osmw_index_3.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=4">'.$osmw_index_4.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=10">'.$osmw_index_10.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=7">'.$osmw_index_7.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=21">'.$osmw_index_21.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=22">'.$osmw_index_22.'</a></p>';
echo '</div>';
// ***********
// TABS ADMINS
// ***********
echo '<div class="tab-pane fade in" id="admin">';
if ($_SESSION['privilege'] >= 4)
{
echo '<p><a class="btn btn-default btn-block" href="?a=15">'.$osmw_index_15.'</a>';
echo '<p><a class="btn btn-default btn-block" href="?a=17">'.$osmw_index_17.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=6">'.$osmw_index_6.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=18">'.$osmw_index_18.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=5">'.$osmw_index_5.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=20">'.$osmw_index_20.'</a></p>';
}
elseif ($_SESSION['privilege'] >= 3)
{
echo '<p><a class="btn btn-default btn-block" href="?a=15">'.$osmw_index_15.'</a>';
echo '<p><a class="btn btn-default btn-block" href="?a=17">'.$osmw_index_17.'</a></p>';
echo '<p><a class="btn btn-default btn-block" href="?a=6">'.$osmw_index_6.'</a></p>';
}
echo '</div>';
echo '</div>';
echo '</div>';
}
}
else
{
?>
<div class="text-center">
<h2 class="title"><span><br>OSMW</span></h2>
</div>
<form class="form-signin" action="index.php" method="post" name="connect">
<?php if (isset($_GET['erreur']) && ($_GET['erreur'] == "login")): ?>
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<strong>Echec d'authentification: login ou mot de passe incorrect ...</strong>
</div>
<?php endif; ?>
<?php if (isset($_GET['erreur']) && ($_GET['erreur'] == "delog")): ?>
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
Deconnexion reussie, a bientot ...
</div>
<?php endif; ?>
<?php if (isset($_GET['erreur']) && ($_GET['erreur'] == "intru")): ?>
<!-- Affiche l'erreur -->
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
Echec d'authentification:<br> Aucune session ouverte ou droits insuffisants pour afficher cette page ...</strong>
</div>
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
Deconnexion reussie, a bientot ...</strong>
</div>
<?php endif; ?>
<img style="height:256px;" class="img-thumbnail img-circle center-block" alt="Logo Server" src="img/logo.png">
<!--<h2 class="form-signin-heading text-center"></h2>-->
<br />
<label for="firstname" class="sr-only">Firstname</label>
<input type="text" id="firstname" name="firstname" class="form-control" placeholder="First Name" required autofocus>
<label for="lastname" class="sr-only">Lastname</label>
<input type="text" id="lastname" name="lastname" class="form-control" placeholder="Last Name" required>
<label for="pass" class="sr-only">Password</label>
<input type="password" id="pass" name="pass" class="form-control" placeholder="Password" required>
<?php
if ($recaptcha)
{
echo '<div class="g-recaptcha" data-sitekey="'.$siteKey.'"></div>';
echo '<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang.'"></script>';
}
?>
<button class="btn btn-lg btn-default btn-block" type="submit">
<span class="glyphicon glyphicon-log-in" aria-hidden="true"></span> Authentification
</button>
</form>
<?php } ?>
<div class="clearfix"></div>
</div>
<footer class="footer">
<p class="text-center">Open Simulator Manager Web <?php echo date(Y); ?> - <?php echo INI_Conf(VersionOSMW, VersionOSMW); ?> </p>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/pdf.js"></script>
<!-- FADE ALERT -->
<script>
window.setTimeout(function() {$(".alert-anim").fadeTo(500, 0).slideUp(500, function() {$(this).remove();});}, 3000);
</script>
<script>$(function () {$('[data-toggle="tooltip"]').tooltip();});</script>
<script>$(document).ready(function(){$('[data-toggle="popover"]').popover();});</script>
<script>$(document).ready(function(){$('.fade-in').hide().fadeIn();});</script>
<!--<script>.modal.in .modal-dialog {transform: none;}</script>-->
<!-- PDF MODAL -->
<script>
$(function(){
$('.view-pdf').on('click',function(){
var pdf_link = $(this).attr('href');
var iframe = '<div class="iframe-container"><iframe src="'+pdf_link+'"></iframe></div>'
$.createModal({
title:'Aide',
message: iframe,
closeButton:true,
scrollable:false
});
return false;
});
})
</script>
</body>
</html>
<?php
}
else
{
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="img/favicon.ico">
<title>OpenSimulator Manager Web</title>
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" media="all" type="text/css" id="css" href="<?php echo $url; ?>" />
<link rel="stylesheet" href="css/btn3d.css" type="text/css" />
<link rel="stylesheet" href="css/login.css" type="text/css" />
<link rel="stylesheet" href="css/custom.css" type="text/css" />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
$('#myTab a').click(function (e) {e.preventDefault(); $(this).tab('show');})
$('#myTab a[href="#profile"]').tab('show')
$('#myTab a:first').tab('show')
$('#myTab a:last').tab('show')
$('#myTab li:eq(2) a').tab('show')
</script>
</head>
<body>
<div class="container">
<?php
// ********************************************************************************************************************************************
// si le fichier n'existe pas
exit('<div class="alert alert-danger">!!! configuration file not exist, <a href="install.php"> Installation </a> !!! </div>'. RETOUR);
echo '</body>
</html>';
}