Subversion Repositories ALCASAR

Rev

Rev 2604 | Rev 2820 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2604 Rev 2766
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: status.php 2604 2018-08-20 00:06:41Z tom.houdayer $
2
# $Id: status.php 2766 2019-11-19 21:37:58Z rexy $
3
#
3
#
4
# status.php for ALCASAR captive portal
4
# status.php for ALCASAR captive portal
5
# by steweb57 & Rexy
5
# by steweb57 & Rexy
6
# 
6
# 
7
/****************************************************************
7
/****************************************************************
Line 173... Line 173...
173
	$l_close_warning		= "Aviso: você será desconectado se fechar esta janela";
173
	$l_close_warning		= "Aviso: você será desconectado se fechar esta janela";
174
	$l_back_homepage		= "Voltar à página inicial";
174
	$l_back_homepage		= "Voltar à página inicial";
175
} else if ($Language === 'de') {	// German
175
} else if ($Language === 'de') {	// German
176
	$l_login1			= "Erfolgreiche Authentifizierung";
176
	$l_login1			= "Erfolgreiche Authentifizierung";
177
	$l_logout			= "Beenden der Verbindung";
177
	$l_logout			= "Beenden der Verbindung";
178
	$l_logout_question		= "Möchten Sie die Verbindung jetzt wirklich trennen?";
178
	$l_logout_question		= "Möchten Sie die Sitzung wirklich beenden?";
179
	$l_loggedout			= "Ihre Sitzung ist geschlossen";
179
	$l_loggedout			= "Ihre Sitzung ist geschlossen";
180
	$l_wait				= "Bitte warten Sie einen Moment ...";
180
	$l_wait				= "Bitte warten Sie einen Moment ...";
181
	$l_state_label			= "State";		// to translate
181
	$l_state_label			= "Status";	
182
	$l_session_id_label		= "Session ID";	// to translate
182
	$l_session_id_label		= "Sitzungs-ID";
183
	$l_max_session_time_label	= "Max Session Time";	// to translate
183
	$l_max_session_time_label	= "Maximale Sitzungszeit";
184
	$l_max_idle_time_label		= "Max Idle Time";		// to translate
184
	$l_max_idle_time_label		= "Maximale Leerlaufzeit";
185
	$l_start_time_label		= "Start Time";	// to translate
185
	$l_start_time_label		= "Startzeit";
186
	$l_session_time_label		= "Online-zeit";
186
	$l_session_time_label		= "Online-Zeit";
187
	$l_idle_time_label		= "Idle Time";	// to translate
187
	$l_idle_time_label		= "Leerlaufzeit";
188
	$l_downloaded_label		= "Downloaded";	// to translate
188
	$l_downloaded_label		= "Heruntergeladen";
189
	$l_uploaded_label		= "Uploaded";	// to translate
189
	$l_uploaded_label		= "Hochgeladen";
190
	$l_original_url_label		= "Original URL";	// to translate
190
	$l_original_url_label		= "Angefragze URL";
191
	$l_not_available		= "Not available";	// to translate
191
	$l_not_available		= "Nicht verfügbar";
192
	$l_error			= "error";		// to translate
192
	$l_error			= "Fehler";
193
	$l_welcome			= "Welcome"; 	// to translate
193
	$l_welcome			= "Willkommen"; 
194
	$l_conn_history			= "Your last $nb_connection_history connections";	// to translate
194
	$l_conn_history			= "Ihre letzten $nb_connection_history Verbindungen";
195
	$l_connected 			= "logged"; // to translate 
195
	$l_connected 			= "gespeichert"; 
196
	$l_a_connection			= "You have"; // to translate
196
	$l_a_connection			= "Sie haben";
197
	$l_a_connection_time		= "active connections on the network"; // to translate
197
	$l_a_connection_time		= "aktive Sitzungen auf dem Netzwerk";
198
	$l_close_warning		= "Warnung: Sie werden getrennt, wenn Sie dieses Fenster schließen";
198
	$l_close_warning		= "Warnung: Sie werden getrennt, wenn Sie dieses Fenster schließen";
199
	$l_back_homepage		= "Zurück zur Startseite";
199
	$l_back_homepage		= "Zurück zur Startseite";
200
} else if ($Language === 'nl') {	// Dutch
200
} else if ($Language === 'nl') {	// Dutch
201
	$l_login1			= "Succesvolle authenticatie";
201
	$l_login1			= "Succesvolle authenticatie";
202
	$l_logout			= "Slotkoers verbinding";
202
	$l_logout			= "Slotkoers verbinding";
Line 290... Line 290...
290
					if (empty($row['acctstoptime'])) {
290
					if (empty($row['acctstoptime'])) {
291
						$connected = $l_connected;
291
						$connected = $l_connected;
292
					} else {
292
					} else {
293
						$connected = secondsToDuration($row['acctsessiontime']);
293
						$connected = secondsToDuration($row['acctsessiontime']);
294
					}
294
					}
295
					$connection_history .= '<li>'.date_format($start_conn, 'd M Y - H:i:s')." - ($connected)</li>";
295
					$connection_history .= '<li>'.date_format($start_conn, 'd M Y - H:i:s').'</li>';//." - ($connected)</>";
296
				}
296
				}
297
				$connection_history .= '</ul>';
297
				$connection_history .= '</ul>';
298
			}
298
			}
299
 
299
 
300
			// Retrieve number of open session
300
			// Retrieve number of open session
Line 317... Line 317...
317
 
317
 
318
	$filename = '/var/tmp/havp/current_users.txt';
318
	$filename = '/var/tmp/havp/current_users.txt';
319
	$user_needKeepOpen = (preg_match("/^$remote_ip:PERM/m", file_get_contents($filename)) === 0);
319
	$user_needKeepOpen = (preg_match("/^$remote_ip:PERM/m", file_get_contents($filename)) === 0);
320
}
320
}
321
 
321
 
-
 
322
////////////////////////////////////////////////////////////////////////////////////////
-
 
323
/////////////////////// TEST VARIABLES ///////////////////////
-
 
324
//////////////////////////////////////////////////////////////
-
 
325
//$nb_open_session = 2;      // >2
-
 
326
//$user_needKeepOpen = true;      // true/false
-
 
327
////////////////////////////////////////////////////////////////////////////////////////
-
 
328
 
322
// Cleaning the cache
329
// Cleaning the cache
323
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
330
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
324
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
331
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
325
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
332
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
326
header('Cache-Control: post-check=0, pre-check=0', false);
333
header('Cache-Control: post-check=0, pre-check=0', false);
Line 329... Line 336...
329
<!DOCTYPE html>
336
<!DOCTYPE html>
330
<html>
337
<html>
331
	<head>
338
	<head>
332
		<meta charset="UTF-8">
339
		<meta charset="UTF-8">
333
		<title>ALCASAR - <?= $organisme ?></title>
340
		<title>ALCASAR - <?= $organisme ?></title>
-
 
341
	
-
 
342
		<link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css">
334
		<link type="text/css" href="css/status.css" rel="stylesheet">
343
		<link type="text/css" href="/css/status.css" rel="stylesheet">
-
 
344
 
335
		<script src="js/ChilliLibrary.js"></script>
345
		<script src="js/ChilliLibrary.js"></script>
336
		<script>
346
		<script>
337
			chilliController.host = '<?= $conf['HOSTNAME'].'.'.$conf['DOMAIN'] ?>';
347
			chilliController.host = '<?= $conf['HOSTNAME'].'.'.$conf['DOMAIN'] ?>';
338
			chilliController.port = <?= (($useHTTPS) ? 3991 : 3990) ?>;
348
			chilliController.port = <?= (($useHTTPS) ? 3991 : 3990) ?>;
339
			chilliController.ssl  = <?= (($useHTTPS) ? 'true' : 'false') ?>;
349
			chilliController.ssl  = <?= (($useHTTPS) ? 'true' : 'false') ?>;
340
		</script>
350
		</script>
341
		<script src="js/statusControler.js"></script>
351
		<script src="js/statusControler.js"></script>
342
	</head>
352
	</head>
343
	<body>
353
	<body>
344
		<div id="Chilli">
-
 
345
			<div id="locationName"></div>
354
	<div id="Chilli" class="col-xs-12 col-sm-12">
346
			<div id="chilliPage">
355
		<div id="chilliPage" class="row">
347
				<div id="loggedOutPage" class="c1">
356
			<div id="loggedOutPage" class="c1 col-xs-12 col-sm-12">
348
					<table id="disconnectTable">
357
				<div id="disconnectTable" class="row logout_box">
349
						<tr>
358
					<div class="col-xs-3 col-sm-3 logout_msg">
350
							<td><img height="150" src="images/logo-alcasar.png" alt="logo"></td>
359
						<img height="150" src="images/logo-alcasar.png" alt="logo">
351
							<td>
360
					</div>
-
 
361
					<div class="col-xs-6 col-sm-6 logout_msg">
352
								<p class="text_auth"><?= $l_loggedout ?></p>
362
							<p class="text_auth"><?= $l_loggedout ?></p>
353
								<p class="text_homelink"><a href="<?= $homepage_url ?>"><?= $l_back_homepage ?></a></p>
363
							<p class="text_homelink"><a href="<?= $homepage_url ?>"><?= $l_back_homepage ?></a></p>
354
							</td>
-
 
355
						</tr>
364
					</div>
356
					</table>
-
 
357
				</div>
365
				</div>
-
 
366
			</div>
358
				<div id="statusPage" class="c1">
367
			<div id="statusPage" class="col-xs-12 col-sm-12">
359
					<table border="0" id="statusTable">
-
 
360
						<tr>
-
 
361
							<td colspan="2">
368
				<div class="row">
362
								<table border="0" cellpadding="0" cellspacing="0" width="100%">
369
					<div class="col-xs-12 col-sm-12 col-md-10 col-md-offset-1">
363
									<tr>
370
						<div class="row header_background">
364
										<td valign="top" rowspan="4">
371
							<div class="header_img hidden-xs col-sm-2">	
365
											<img height="150" src="images/logo-alcasar.png" alt="logo">
372
								<img class="img-responsive image-resize" src="images/logo-alcasar.png" alt="logo">
366
										</td>
373
							</div>
367
										<td class="text_auth_welcom">
374
							<div class="header_title col-xs-12 col-sm-8">
368
											<?= $l_login1 ?>
375
								<p class="login-status"><?= $l_login1 ?></p>
369
										</td>
376
							</div>
370
									</tr>
377
						</div>
371
									<tr>
378
					</div>
-
 
379
				</div>
372
										<td class="text_auth">
380
				<div class="row main_box">	
-
 
381
					<div class="col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
373
											<?= $l_welcome ?><br><?= $cn ?>
382
						<div class="row background-display">
374
										</td>
383
							<div class="col-xs-12 col-sm-10 col-sm-offset-1">
375
									</tr>
384
								<div class="row">
-
 
385
									<p class="welcome-user"><?= $l_welcome ?> <?= $cn ?></p>
376
									<tr>
386
								</div>	
377
										<td class="alert">
387
								<div class="row nb_open_session">
378
											<?= ((isset($nb_open_session) && ($nb_open_session > 1)) ? $l_a_connection.' '.$nb_open_session.' '.$l_a_connection_time : '') ?>
388
									<?= ((isset($nb_open_session) && ($nb_open_session > 1)) ? $l_a_connection.' '.$nb_open_session.' '.$l_a_connection_time : '') ?>
379
										</td>
-
 
380
									</tr>
389
								</div>
381
									<tr>
390
								<div class="row">
382
										<td colspan="2" align="center" class="link_logout">
391
									<table class="table table-striped" id="statusTable">
383
											<a href="#" onclick="return logoutWithConfirmation('<?= $l_logout_question ?>');" class="lien_deco"><?= $l_logout ?></a>
-
 
384
										</td>
392
										<!-- 
385
									</tr>
-
 
386
								</table>
-
 
387
							</td>
-
 
388
						</tr>
-
 
389
<!-- 
-
 
390
						<tr id="connectRow">
393
										<tr id="connectRow">
391
							<td id="statusMessageLabel" class="chilliLabel"><strong><?= $l_state_label ?></strong></td>
394
											<td id="statusMessageLabel" class="chilliLabel"><strong><?= $l_state_label ?></strong></td>
392
							<td id="statusMessage" class="chilliValue">Connected</td>
395
											<td id="statusMessage" class="chilliValue">Connected</td>
393
						</tr>
396
										</tr>
394
						<tr id="sessionIdRow">
397
										<tr id="sessionIdRow">
395
							<td id="sessionIdLabel" class="chilliLabel"><strong><?= $l_session_id_label ?></strong></td>
398
											<td id="sessionIdLabel" class="chilliLabel"><strong><?= $l_session_id_label ?></strong></td>
396
							<td id="sessionId" class="chilliValue"><?= $l_not_available ?></td>
399
											<td id="sessionId" class="chilliValue"><?= $l_not_available ?></td>
397
						</tr>
400
										</tr>
398
-->
401
			-->
399
						<tr id="sessionTimeoutRow">
402
										<tr id="sessionTimeoutRow" class="table-border">
400
							<td id="sessionTimeoutLabel" class="chilliLabel"><?= $l_max_session_time_label ?></td>
403
											<td id="sessionTimeoutLabel" class="chilliLabel"><?= $l_max_session_time_label ?>: </td>
401
							<td id="sessionTimeout" class="chilliValue"><?= $l_not_available ?></td>
404
											<td id="sessionTimeout" class="chilliValue"><?= $l_not_available ?></td>
402
						</tr>
405
										</tr>
403
						<tr id="idleTimeoutRow">
406
										<tr id="idleTimeoutRow">
404
							<td id="idleTimeoutLabel" class="chilliLabel"><?= $l_max_idle_time_label ?></td>
407
											<td id="idleTimeoutLabel" class="chilliLabel"><?= $l_max_idle_time_label ?>: </td>
405
							<td id="idleTimeout" class="chilliValue"><?= $l_not_available ?></td>
408
											<td id="idleTimeout" class="chilliValue"><?= $l_not_available ?></td>
406
						</tr>
409
										</tr>
407
						<tr id="startTimeRow">
410
										<tr id="startTimeRow">
408
							<td id="startTimeLabel" class="chilliLabel"><?= $l_start_time_label ?></td>
411
											<td id="startTimeLabel" class="chilliLabel"><?= $l_start_time_label ?>: </td>
409
							<td id="startTime" class="chilliValue"><?= $l_not_available ?></td>
412
											<td id="startTime" class="chilliValue"><?= $l_not_available ?></td>
410
						</tr>
413
										</tr>
411
						<tr id="sessionTimeRow">
414
										<tr id="sessionTimeRow">
412
							<td id="sessionTimeLabel" class="chilliLabel"><?= $l_session_time_label ?></td>
415
											<td id="sessionTimeLabel" class="chilliLabel"><?= $l_session_time_label ?>: </td>
413
							<td id="sessionTime" class="chilliValue"><?= $l_not_available ?></td>
416
											<td id="sessionTime" class="chilliValue"><?= $l_not_available ?></td>
414
						</tr>
417
										</tr>
415
						<tr id="idleTimeRow">
418
										<tr id="idleTimeRow">
416
							<td id="idleTimeLabel" class="chilliLabel"><?= $l_idle_time_label ?></td>
419
											<td id="idleTimeLabel" class="chilliLabel"><?= $l_idle_time_label ?>: </td>
417
							<td id="idleTime" class="chilliValue"><?= $l_not_available ?></td>
420
											<td id="idleTime" class="chilliValue"><?= $l_not_available ?></td>
418
						</tr>
421
										</tr>
419
						<tr id="inputOctetsRow">
422
										<tr id="inputOctetsRow">
420
							<td id="inputOctetsLabel" class="chilliLabel"><?= $l_downloaded_label ?></td>
423
											<td id="inputOctetsLabel" class="chilliLabel"><?= $l_downloaded_label ?>: </td>
421
							<td id="inputOctets" class="chilliValue"><?= $l_not_available ?></td>
424
											<td id="inputOctets" class="chilliValue"><?= $l_not_available ?></td>
422
						</tr>
425
										</tr>
423
						<tr id="outputOctetsRow">
426
										<tr id="outputOctetsRow">
424
							<td id="outputOctetsLabel" class="chilliLabel"><?= $l_uploaded_label ?></td>
427
											<td id="outputOctetsLabel" class="chilliLabel"><?= $l_uploaded_label ?>: </td>
425
							<td id="outputOctets" class="chilliValue"><?= $l_not_available ?></td>
428
											<td id="outputOctets" class="chilliValue"><?= $l_not_available ?></td>
426
						</tr>
429
										</tr>
427
<!-- 
430
			<!-- 
428
						<tr id="originalURLRow">
431
										<tr id="originalURLRow">
429
							<td id="originalURLLabel" class="chilliLabel"><?= $l_original_url_label ?></td>
432
											<td id="originalURLLabel" class="chilliLabel"><?= $l_original_url_label ?></td>
430
							<td id="originalURL" class="chilliValue"><?= $l_not_available ?></td>
433
											<td id="originalURL" class="chilliValue"><?= $l_not_available ?></td>
431
						</tr>
434
										</tr>
432
 -->
435
			 -->
-
 
436
										<?php if (isset($user_needKeepOpen) && ($user_needKeepOpen === true)): ?>
433
						<tr>
437
											<tr>
434
							<td colspan="2" id="conHistoryLabel" class="chilliLabel"><?= $l_conn_history ?></td>
438
												<td colspan="2" id="close-warning">(<?= $l_close_warning ?>)</td>
435
						</tr>
439
											</tr>
436
						<tr id="conHistoryRow">
440
										<?php endif; ?>
-
 
441
									</table>
-
 
442
								</div>
437
							<td colspan="2" id="conHistory" class="chilliValue"><?= $connection_history ?></td>
443
								<button onclick="return logoutWithConfirmation('<?= $l_logout_question ?>');" class="button btn btn-danger btn-md"><?= $l_logout ?></button>
-
 
444
							</div>
438
						</tr>
445
						</div>
-
 
446
					</div>
439
						<?php if (isset($user_needKeepOpen) && ($user_needKeepOpen === true)): ?>
447
					<div class="hidden-xs hidden-sm hidden-md col-lg-2 history">
-
 
448
						<div class="row">
-
 
449
							<div class="hidden-xs col-lg-11 col-lg-offset-1 log-box">
-
 
450
								<div class="row log-titre">	
-
 
451
									<div class="col-lg-12">
-
 
452
									<?= $l_conn_history ?>
-
 
453
									</div>
440
							<tr>
454
								</div>
441
								<td colspan="2" id="close-warning">(<?= $l_close_warning ?>)</td>
455
								<div class="row log-info">
-
 
456
									<?= $connection_history ?>
-
 
457
								</div>
442
							</tr>
458
							</div>
443
						<?php endif; ?>
459
						</div>
444
					</table>
460
					</div>
445
				</div>
461
				</div>
446
				<div id="waitPage">
462
				<div class="row">
-
 
463
					<div class="col-xs-3 hidden-sm hidden-md hidden-lg">	
-
 
464
						<img class="img-responsive image-resize-bottom" src="images/logo-alcasar.png" alt="logo">
-
 
465
					</div>
-
 
466
					<div class="col-xs-6 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 hidden-lg history_bottom">
-
 
467
						<div class="row log-titre-petit">	
447
					<table id="waitTable">
468
							<?= $l_conn_history ?>
448
						<tr>
469
						</div>
449
							<td><img height="150" src="images/logo-alcasar.png" alt="logo"></td>
470
						<div class="row log-info-petit">
450
							<td><p class="text_auth"><img src="images/wait.gif" width="16" height="16" class="wait" alt="<?= $l_wait ?>"><?= $l_wait ?></p></td>
471
							<?= $connection_history ?>
451
						</tr>
472
						</div>
452
					</table>
473
					</div>
453
				</div>
474
				</div>
-
 
475
			</div>
-
 
476
			<div id="waitPage" class="col-xs-12 col-sm-12">
454
				<div id="errorPage">
477
				<div class="row waiting_box">
455
					<table id="errorTable">
478
					<div class="col-xs-3 col-sm-3 waiting_msg">
-
 
479
						<img height="150" src="images/logo-alcasar.png" alt="logo">
456
						<tr>
480
					</div>
-
 
481
					<div class="col-xs-6 col-sm-6 waiting_msg">
457
							<td><img height="150" src="images/logo-alcasar.png" alt="logo"></td>
482
						<p class="text_auth"><img src="images/wait.gif" width="16" height="16" class="wait" alt="<?= $l_wait ?>"><?= $l_wait ?></p>
-
 
483
					</div>
-
 
484
				</div>
-
 
485
			</div>
458
							<td><span id="errorMessage"><?= $l_error ?></span></td>
486
			<div id="errorPage" class="col-xs-12 col-sm-12">
-
 
487
				<div class="row error_box">
-
 
488
					<div class="col-xs-3 col-sm-3 error_msg">
-
 
489
						<img height="150" src="images/logo-alcasar.png" alt="logo">
459
						</tr>
490
					</div>
-
 
491
					<div class="col-xs-6 col-sm-6 error_msg">
-
 
492
						<p id="errorMessage"><?= $l_error ?></p>
460
					</table>
493
					</div>
461
				</div>
494
				</div>
462
			</div>
495
			</div>
463
		</div>
496
		</div>
-
 
497
	</div>
464
	</body>
498
	</body>
465
</html>
499
</html>