Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
# $Id: intercept.php 2923 2021-02-23 09:59:54Z rexy $
|
2 |
# $Id: intercept.php 2935 2021-03-28 22:14:58Z rexy $
|
3 |
#
|
3 |
#
|
4 |
# intercept.php for ALCASAR captive portal
|
4 |
# intercept.php for ALCASAR captive portal
|
5 |
# Copyright (C) 2003, 2004 Mondru AB.
|
5 |
# Copyright (C) 2003, 2004 Mondru AB.
|
6 |
# Modify by REXY & steweb57
|
6 |
# Modify by REXY & steweb57
|
7 |
# UI & css style by stephane ERARD
|
7 |
# UI & css style by stephane ERARD
|
Line 54... |
Line 54... |
54 |
}
|
54 |
}
|
55 |
}
|
55 |
}
|
56 |
fclose($file_conf);
|
56 |
fclose($file_conf);
|
57 |
|
57 |
|
58 |
$organisme = $conf["ORGANISM"];
|
58 |
$organisme = $conf["ORGANISM"];
|
- |
|
59 |
$service_SMS_status = ($conf['SMS'] === 'on');
|
- |
|
60 |
$service_wifi4eu_status = ($conf['WIFI4EU'] === 'on');
|
- |
|
61 |
$service_wifi4eu_code = $conf['WIFI4EU_CODE'];
|
- |
|
62 |
$service_wifi4eu_server = 'https://collection.wifi4eu.ec.europa.eu/wifi4eu.min.js';
|
59 |
|
63 |
|
60 |
// Shared secret used to encrypt password with coova.
|
64 |
// Shared secret used to encrypt password with coova.
|
61 |
$uamsecret = "";
|
65 |
$uamsecret = "";
|
62 |
|
66 |
|
63 |
// URL loaded after success authenticates (let blank for browser defaults)
|
67 |
// URL loaded after success authenticates (let blank for browser defaults)
|
64 |
$adminurl = "";
|
68 |
$adminurl = "";
|
65 |
|
69 |
|
66 |
// Check if the SMS service is enable
|
- |
|
67 |
$service_SMS_status = ($conf['SMS'] === 'on');
|
- |
|
68 |
|
- |
|
69 |
// Our own path
|
70 |
// Our own path
|
70 |
$loginpath = htmlspecialchars($_SERVER['PHP_SELF']);
|
71 |
$loginpath = htmlspecialchars($_SERVER['PHP_SELF']);
|
71 |
$useHTTPS = ((isset($_SERVER['HTTPS'])) && (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] !== 'off'));
|
72 |
$useHTTPS = ((isset($_SERVER['HTTPS'])) && (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] !== 'off'));
|
72 |
$alcasarpath = (($useHTTPS) ? 'https' : 'http' ).'://'.$conf['HOSTNAME'].'.'.$conf['DOMAIN'];
|
73 |
$alcasarpath = (($useHTTPS) ? 'https' : 'http' ).'://'.$conf['HOSTNAME'].'.'.$conf['DOMAIN'];
|
73 |
$statuspath = (($conf['HTTPS_CHILLI'] === 'on') ? 'https' : 'http' ).'://'.$conf['HOSTNAME'].'.'.$conf['DOMAIN'].'/status.php';
|
74 |
$statuspath = (($conf['HTTPS_CHILLI'] === 'on') ? 'https' : 'http' ).'://'.$conf['HOSTNAME'].'.'.$conf['DOMAIN'].'/status.php';
|
Line 506... |
Line 507... |
506 |
<!DOCTYPE html>
|
507 |
<!DOCTYPE html>
|
507 |
<html>
|
508 |
<html>
|
508 |
<head>
|
509 |
<head>
|
509 |
<meta charset="utf-8">
|
510 |
<meta charset="utf-8">
|
510 |
<title><?= $l_loggingin ?></title>
|
511 |
<title><?= $l_loggingin ?></title>
|
- |
|
512 |
<link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css">
|
- |
|
513 |
<link rel="stylesheet" href="/css/intercept.css" type="text/css">
|
- |
|
514 |
<link rel="icon" href="/images/favicon-48.ico" type="image/ico">
|
- |
|
515 |
<? if ($service_wifi4eu_status): ?>
|
- |
|
516 |
<script type="text/javascript">
|
- |
|
517 |
var wifi4euTimerStart = Date.now();
|
- |
|
518 |
var wifi4euNetworkIdentifier = '<?= $service_wifi4eu_code ?>';
|
- |
|
519 |
var wifi4euLanguage = '<?= $Language ?>';
|
- |
|
520 |
//var selftestModus = true;
|
- |
|
521 |
</script>
|
- |
|
522 |
<script type="text/javascript" src="<?= $service_wifi4eu_server ?>"></script>
|
- |
|
523 |
<? endif; ?>
|
511 |
<script type="text/javascript">
|
524 |
<script type="text/javascript">
|
512 |
function doOnLoad(result, userurl, redirurl, adminurl, timeleft) {
|
525 |
function doOnLoad(result, userurl, redirurl, adminurl, timeleft) {
|
513 |
if ((result === 1) || (result === 4)) { // success or already
|
526 |
if ((result === 1) || (result === 4)) { // success or already
|
514 |
var url;
|
527 |
var url;
|
515 |
if (adminurl !== '') {
|
528 |
if (adminurl !== '') {
|
Line 535... |
Line 548... |
535 |
if ((result === 2) || (result === 3) || result === 5) { // failed or logoff or notyet
|
548 |
if ((result === 2) || (result === 3) || result === 5) { // failed or logoff or notyet
|
536 |
document.form1.username.focus();
|
549 |
document.form1.username.focus();
|
537 |
}
|
550 |
}
|
538 |
}
|
551 |
}
|
539 |
</script>
|
552 |
</script>
|
540 |
<link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css">
|
- |
|
541 |
<link rel="stylesheet" href="/css/intercept.css" type="text/css">
|
- |
|
542 |
<link rel="icon" href="/images/favicon-48.ico" type="image/ico">
|
- |
|
543 |
</head>
|
553 |
</head>
|
544 |
<body onLoad="javascript:doOnLoad(<?= $result ?>,'<?= $userurl ?>','<?= $redirurl ?>','<?= $adminurl ?>','<?= $timeleft ?>')">
|
554 |
<body onLoad="javascript:doOnLoad(<?= $result ?>,'<?= $userurl ?>','<?= $redirurl ?>','<?= $adminurl ?>','<?= $timeleft ?>')">
|
545 |
<div class="col-xs-12">
|
555 |
<div class="col-xs-12">
|
546 |
<?php if ($result === 2 || $result === 3 || $result === 5): // failed or logoff or notyet ?>
|
556 |
<?php if ($result === 2 || $result === 3 || $result === 5): // failed or logoff or notyet ?>
|
547 |
<div class ="row">
|
557 |
<div class ="row">
|
548 |
<div class="col-xs-12 col-sm-10 col-sm-offset-1">
|
558 |
<div class="col-xs-12 col-sm-10 col-sm-offset-1">
|
549 |
<div class="row banner">
|
559 |
<div class="row banner">
|
550 |
<div class="col-xs-8 col-xs-offset-2 col-sm-12 col-sm-offset-0">
|
560 |
<div class="col-xs-8 col-xs-offset-2 col-sm-12 col-sm-offset-0">
|
- |
|
561 |
<?php if ($service_wifi4eu_status): ?>
|
- |
|
562 |
<img id="wifi4eubanner">
|
- |
|
563 |
<?php else: ?>
|
551 |
<h1 class="organisme"><?= $organisme ?></h1>
|
564 |
<h1 class="organisme"><?= $organisme ?></h1>
|
- |
|
565 |
<?php endif; ?>
|
552 |
</div>
|
566 |
</div>
|
553 |
</div>
|
567 |
</div>
|
554 |
<div class="row">
|
568 |
<div class="row">
|
555 |
<form name="form1" class="form-horizontal col-xs-12 col-sm-12 col-md-10 col-md-offset-1 background-form" method="post" action="<?= $loginpath ?>">
|
569 |
<form name="form1" class="form-horizontal col-xs-12 col-sm-12 col-md-10 col-md-offset-1 background-form" method="post" action="<?= $loginpath ?>">
|
556 |
<div class="row">
|
570 |
<div class="row">
|
Line 563... |
Line 577... |
563 |
$tab = file(DOMAIN_ALLOWED_LIST);
|
577 |
$tab = file(DOMAIN_ALLOWED_LIST);
|
564 |
if ($tab) { // the file isn't empty
|
578 |
if ($tab) { // the file isn't empty
|
565 |
echo '<div id="authorized_domain">'.$l_uam_domain.'</div>';
|
579 |
echo '<div id="authorized_domain">'.$l_uam_domain.'</div>';
|
566 |
echo '<ul>';
|
580 |
echo '<ul>';
|
567 |
foreach ($tab as $line) {
|
581 |
foreach ($tab as $line) {
|
568 |
if (trim($line) !== '') { // the line isn't empty
|
582 |
if (!empty(trim($line))) { // the line isn't empty
|
569 |
$domain_allowed = explode('#', $line);
|
583 |
if (strpos ($line, '#')) { // the domain should be displayed
|
570 |
if (trim($domain_allowed[1]) !== '') {
|
584 |
$domain_allowed = explode('#', $line);
|
571 |
$domain = explode('"', $domain_allowed[0]);
|
585 |
$domain = explode('"', $domain_allowed[0]);
|
572 |
// remove every '.' from the beginning of domain
|
586 |
$domain[1] = ltrim($domain[1], '.'); // remove every '.' from the beginning of domain
|
573 |
$domain[1] = ltrim($domain[1], '.');
|
- |
|
574 |
echo '<li><a href="http://'.trim($domain[1]).'">'.trim($domain_allowed[1]).'</a></li>';
|
587 |
echo '<li><a href="http://'.trim($domain[1]).'">'.trim($domain_allowed[1]).'</a></li>';
|
575 |
}
|
588 |
}
|
576 |
}
|
589 |
}
|
577 |
}
|
590 |
}
|
578 |
echo '</ul>';
|
591 |
echo '</ul>';
|
Line 676... |
Line 689... |
676 |
$tab = file(DOMAIN_ALLOWED_LIST);
|
689 |
$tab = file(DOMAIN_ALLOWED_LIST);
|
677 |
if ($tab) { // the file isn't empty
|
690 |
if ($tab) { // the file isn't empty
|
678 |
echo '<div id="authorized_domain">'.$l_uam_domain.'</div>';
|
691 |
echo '<div id="authorized_domain">'.$l_uam_domain.'</div>';
|
679 |
echo '<ul>';
|
692 |
echo '<ul>';
|
680 |
foreach ($tab as $line) {
|
693 |
foreach ($tab as $line) {
|
681 |
if (trim($line) !== '') { // the line isn't empty
|
694 |
if (!empty(trim($line))) { // the line isn't empty
|
682 |
$domain_allowed = explode('#', $line);
|
695 |
if (strpos ($line, '#')) { // the domain should be displayed
|
683 |
if (trim($domain_allowed[1]) !== '') {
|
696 |
$domain_allowed = explode('#', $line);
|
684 |
$domain = explode('"', $domain_allowed[0]);
|
697 |
$domain = explode('"', $domain_allowed[0]);
|
685 |
// remove every '.' from the beginning of domain
|
698 |
$domain[1] = ltrim($domain[1], '.'); // remove every '.' from the beginning of domain
|
686 |
$domain[1] = ltrim($domain[1], '.');
|
- |
|
687 |
echo '<li><a href="http://'.trim($domain[1]).'">'.trim($domain_allowed[1]).'</a></li>';
|
699 |
echo '<li><a href="http://'.trim($domain[1]).'">'.trim($domain_allowed[1]).'</a></li>';
|
688 |
}
|
700 |
}
|
689 |
}
|
701 |
}
|
690 |
}
|
702 |
}
|
691 |
echo '</ul>';
|
703 |
echo '</ul>';
|