Subversion Repositories ALCASAR

Rev

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

Rev 2934 Rev 2935
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: index.php 2934 2021-03-27 18:24:00Z rexy $
2
# $Id: index.php 2935 2021-03-28 22:14:58Z rexy $
3
#
3
#
4
# index.php for ALCASAR by Rexy
4
# index.php for ALCASAR by Rexy
5
# UI & css style by stephane ERARD
5
# UI & css style by stephane ERARD
6
# The contents of this file may be used under the terms of the GNU
6
# The contents of this file may be used under the terms of the GNU
7
# General Public License Version 2, provided that the above copyright
7
# General Public License Version 2, provided that the above copyright
Line 57... Line 57...
57
$connection_history = '';
57
$connection_history = '';
58
$nb_connection_history = 3;
58
$nb_connection_history = 3;
59
$redirect_link = 'www.euronews.com'; // Default redirection for HTTP interception (beware, this website must run in HTTP)
59
$redirect_link = 'www.euronews.com'; // Default redirection for HTTP interception (beware, this website must run in HTTP)
60
$service_wifi4eu_status = ($conf['WIFI4EU'] === 'on');
60
$service_wifi4eu_status = ($conf['WIFI4EU'] === 'on');
61
$service_wifi4eu_code = $conf['WIFI4EU_CODE'];
61
$service_wifi4eu_code = $conf['WIFI4EU_CODE'];
-
 
62
$service_wifi4eu_server = 'https://collection.wifi4eu.ec.europa.eu/wifi4eu.min.js';
62
$service_SMS_status = ($conf['SMS'] === 'on');
63
$service_SMS_status = ($conf['SMS'] === 'on');
63
 
64
 
64
// Retrieve the user info behind the remote ip
65
// Retrieve the user info behind the remote ip
65
$output = [];
66
$output = [];
66
exec('sudo /usr/sbin/chilli_query list ip '.escapeshellarg($remote_ip), $output);
67
exec('sudo /usr/sbin/chilli_query list ip '.escapeshellarg($remote_ip), $output);
Line 456... Line 457...
456
	// Read the "Domain allowed" file
457
	// Read the "Domain allowed" file
457
	$domainsAllowed = [];
458
	$domainsAllowed = [];
458
	$fileContent = file(DOMAIN_ALLOWED_LIST); if ($fileContent) { // the file isn't empty
459
	$fileContent = file(DOMAIN_ALLOWED_LIST); if ($fileContent) { // the file isn't empty
459
       	foreach ($fileContent as $line) {
460
       	foreach ($fileContent as $line) {
460
			if (!empty(trim($line))) {
461
			if (!empty(trim($line))) {
-
 
462
				if (strpos ($line, '#')) { // the domain should be displayed
461
				$domain_fields = explode('#', $line);
463
					$domain_fields = explode('#', $line);
462
				if (!empty(trim($domain_fields[1]))) {
-
 
463
					$domain = explode('"', $domain_fields[0]);
464
					$domain = explode('"', $domain_fields[0]);
464
					$domain[1] = ltrim($domain[1], '.'); // remove every '.' from the beginning of domain
465
					$domain[1] = ltrim($domain[1], '.'); // remove every '.' from the beginning of domain
465
					$domainsAllowed[] = (object) [
466
					$domainsAllowed[] = (object) [
466
						'name'   => trim($domain_fields[1]),
467
						'name'   => trim($domain_fields[1]),
467
						'domain' => trim($domain[1])
468
						'domain' => trim($domain[1])
Line 532... Line 533...
532
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
533
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
533
		<title><?= $l_title ?></title>
534
		<title><?= $l_title ?></title>
534
		<link rel="stylesheet" type="text/css" href="<?= ((!$direct_access) ? "//$hostname" : '') ?>/css/bootstrap.min.css">
535
		<link rel="stylesheet" type="text/css" href="<?= ((!$direct_access) ? "//$hostname" : '') ?>/css/bootstrap.min.css">
535
		<link rel="stylesheet" type="text/css" href="/css/index.css">
536
		<link rel="stylesheet" type="text/css" href="/css/index.css">
536
		<link rel="icon" href="/images/favicon-48.ico" type="image/ico">
537
		<link rel="icon" href="/images/favicon-48.ico" type="image/ico">
-
 
538
<? if ($service_wifi4eu_status): ?>
-
 
539
		<script type="text/javascript">
-
 
540
			var wifi4euTimerStart = Date.now();
-
 
541
			var wifi4euNetworkIdentifier = '<?= $service_wifi4eu_code ?>';
-
 
542
			var wifi4euLanguage = '<?= $Language ?>';
-
 
543
			//var selftestModus = true;
537
		<?
544
		</script>
-
 
545
		<script type="text/javascript" src="<?= $service_wifi4eu_server ?>"></script>
538
		?>		
546
<? endif; ?>
539
	</head>
547
	</head>
540
	<body>
548
	<body>
541
	<div class="col-xs-12 col-md-10 col-md-offset-1"> 
549
	<div class="col-xs-12 col-md-10 col-md-offset-1"> 
542
 
550
 
543
		<!-- HeaderBox -->
551
		<!-- HeaderBox -->
Line 548... Line 556...
548
			</div>
556
			</div>
549
 
557
 
550
			<!-- Title -->
558
			<!-- Title -->
551
			<div id="cadre_titre" class="titre_banner col-xs-12 col-sm-8">
559
			<div id="cadre_titre" class="titre_banner col-xs-12 col-sm-8">
552
				<?php if ($direct_access): ?>
560
				<?php if ($direct_access): ?>
-
 
561
					<?php if ($service_wifi4eu_status): ?>
-
 
562
						<img id="wifi4eubanner">
-
 
563
					<?php else: ?>
553
				<p id="acces_controle" class="titre_controle"><?= $l_title ?></p>
564
						<p id="acces_controle" class="titre_controle"><?= $l_title ?></p>
-
 
565
					<?php endif; ?>
554
				<?php if ($network_pb): ?>
566
				<?php if ($network_pb): ?>
555
					<div class="explanation_net_pb"><?= $l_explain_net_pb ?></div>
567
					<div class="explanation_net_pb"><?= $l_explain_net_pb ?></div>
556
				<?php endif; ?>
568
				<?php endif; ?>
557
				<?php else: // the user is intercepted ?>
569
				<?php else: // the user is intercepted ?>
558
					<?php if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1'): // if user need to be warm that someone reads his log ?>
570
					<?php if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1'): // if user need to be warm that someone reads his log ?>