Subversion Repositories ALCASAR

Rev

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

Rev 3026 Rev 3034
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: index.php 3026 2022-06-30 21:53:54Z rexy $
2
# $Id: index.php 3034 2022-07-06 09:19:47Z rexy $
3
#
3
#
4
# index.php for ALCASAR by Rexy
4
# index.php for ALCASAR by Rexy
5
# UI & css style by Stéphane ERARD & Alexandre VEZIN
5
# UI & css style by Stéphane ERARD & Alexandre VEZIN
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 61... Line 61...
61
$service_wifi4eu_status = ($conf['WIFI4EU'] === 'on');
61
$service_wifi4eu_status = ($conf['WIFI4EU'] === 'on');
62
$service_wifi4eu_code = $conf['WIFI4EU_CODE'];
62
$service_wifi4eu_code = $conf['WIFI4EU_CODE'];
63
$service_wifi4eu_server = 'https://collection.wifi4eu.ec.europa.eu/wifi4eu.min.js';
63
$service_wifi4eu_server = 'https://collection.wifi4eu.ec.europa.eu/wifi4eu.min.js';
64
$service_SMS_status = ($conf['SMS'] === 'on');
64
$service_SMS_status = ($conf['SMS'] === 'on');
65
$service_Email_status = ($conf['MAIL'] === 'on');
65
$service_Email_status = ($conf['MAIL'] === 'on');
-
 
66
$certificateInfos = openssl_x509_parse(file_get_contents('/etc/pki/tls/certs/alcasar.crt'));
-
 
67
$cert_autoissued = ($certificateInfos["subject"]["O"] == $certificateInfos["issuer"]["O"]);
66
 
68
 
67
// Retrieve the user info behind the remote ip
69
// Retrieve the user info behind the remote ip
68
$output = [];
70
$output = [];
69
exec('sudo /usr/sbin/chilli_query list ip '.escapeshellarg($remote_ip), $output);
71
exec('sudo /usr/sbin/chilli_query list ip '.escapeshellarg($remote_ip), $output);
70
if (!empty($output)) {
72
if (!empty($output)) {
Line 137... Line 139...
137
		header("Location: $redir", true, 307);
139
		header("Location: $redir", true, 307);
138
		exit();
140
		exit();
139
	}
141
	}
140
}
142
}
141
 
143
 
-
 
144
if(!$cert_autoissued && !isset($_SERVER["HTTPS"])){
-
 
145
    header("Location: https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"], true, 301);
-
 
146
    exit();
-
 
147
}
-
 
148
 
142
// Choice of language
149
// Choice of language
143
$Language = 'en';
150
$Language = 'en';
144
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
151
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
145
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
152
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
146
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
153
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
Line 577... Line 584...
577
							<div class="menu-image">
584
							<div class="menu-image">
578
								<img class="img-fluid" src="<?= $img_rep.$img_internet ?>">
585
								<img class="img-fluid" src="<?= $img_rep.$img_internet ?>">
579
							</div>
586
							</div>
580
						</div>
587
						</div>
581
 
588
 
-
 
589
						<?php if ($cert_autoissued): ?>
582
						<div class="box_menu_right box_menu" id="box_certif">
590
							<div class="box_menu_right box_menu" id="box_certif">
583
							<span><a href="<?= $certCa_link ?>"><?= $l_install_certif ?></a></span>
591
								<span><a href="<?= $certCa_link ?>"><?= $l_install_certif ?></a></span>
584
							<div class="menu-image">
592
								<div class="menu-image">
585
								<img class="img-fluid" src="<?= $img_rep.$img_certificate ?>">
593
									<img class="img-fluid" src="<?= $img_rep.$img_certificate ?>">
-
 
594
								</div>
586
							</div>
595
							</div>
587
						</div>
596
						<?php endif; ?>
588
 
597
 
589
						<div class="box_menu" id="box_mdp" >
598
						<div class="box_menu" id="box_mdp" >
590
							<div class="menu-image">
599
							<div class="menu-image">
591
								<img class="img-fluid" src="<?= $img_rep.$img_pwd ?>">
600
								<img class="img-fluid" src="<?= $img_rep.$img_pwd ?>">
592
							</div>
601
							</div>