Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
# $Id: index.php 1818 2016-04-07 13:38:05Z raphael.pion $
|
2 |
# $Id: index.php 1820 2016-04-07 13:59:46Z raphael.pion $
|
3 |
#
|
3 |
#
|
4 |
# index.php for ALCASAR captive portal
|
4 |
# index.php for ALCASAR captive portal
|
5 |
# by REXY
|
5 |
# by REXY
|
6 |
# UI & css style by stephane ERARD
|
6 |
# UI & css style by stephane ERARD
|
7 |
# The contents of this file may be used under the terms of the GNU
|
7 |
# The contents of this file may be used under the terms of the GNU
|
Line 55... |
Line 55... |
55 |
$nb_connection_history = 3;
|
55 |
$nb_connection_history = 3;
|
56 |
|
56 |
|
57 |
# Obtenir l'état de connexion de l'utilisateur. 1 si connecté sinon 0.
|
57 |
# Obtenir l'état de connexion de l'utilisateur. 1 si connecté sinon 0.
|
58 |
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
|
58 |
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
|
59 |
$user = explode (" ", $tab[0]);
|
59 |
$user = explode (" ", $tab[0]);
|
60 |
|
60 |
|
61 |
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
|
61 |
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
|
62 |
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || preg_match ("/^alcasar$/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname$/", $_SERVER['HTTP_HOST']) || preg_match ("/^$organisme$/", $_SERVER['HTTP_HOST']))
|
62 |
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || preg_match ("/^alcasar$/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname$/", $_SERVER['HTTP_HOST']) || preg_match ("/^$organisme$/", $_SERVER['HTTP_HOST']))
|
63 |
{
|
63 |
{
|
64 |
$direct_access=True;
|
64 |
$direct_access=True;
|
65 |
|
- |
|
66 |
}
|
65 |
}
|
67 |
#### Affichage des 3 dernières connexions de $user[5]
|
66 |
#### Affichage des 3 dernières connexions de $user[5]
|
68 |
function secondsToDuration($seconds = null){
|
67 |
function secondsToDuration($seconds = null){
|
69 |
if ($seconds == null) return "";
|
68 |
if ($seconds == null) return "";
|
70 |
|
69 |
|
Line 101... |
Line 100... |
101 |
}
|
100 |
}
|
102 |
}
|
101 |
}
|
103 |
}
|
102 |
}
|
104 |
else
|
103 |
else
|
105 |
{
|
104 |
{
|
106 |
# cas où l'utilisateur non-loggué décide de joindre une page HTTP ou HTTPS ou alcasar (on va l'intercepter en le redirigeant sur index.php afin qu'il puisse se logguer)
|
105 |
# cas où l'utilisateur non-loggué décide de joindre une page HTTP/S => redirection index.php&url=URL
|
- |
|
106 |
# ALCASAR => redirection index.php
|
107 |
# on place l'utilisateur dans un ipset user_not_connected pour ne pas boucler
|
107 |
# on place l'IP de l'utilisateur dans un ipset user_not_connected pour ne pas boucler
|
108 |
# si il ne joint pas ALCASAR, on le redirige vers celui ci
|
- |
|
109 |
exec("sudo /usr/sbin/ipset add user_not_connected_yet $remote_ip");
|
108 |
exec("sudo /usr/sbin/ipset add user_not_connected_yet $remote_ip");
|
110 |
if(!$direct_access)
|
109 |
if(!$direct_access)
|
111 |
{
|
110 |
{
|
112 |
header("Location: http://alcasar");
|
111 |
header("Location: http://alcasar?url=".$_SERVER['HTTP_HOST']);
|
113 |
exit;
|
112 |
exit;
|
114 |
}
|
113 |
}
|
115 |
|
114 |
|
116 |
}
|
115 |
}
|
117 |
|
- |
|
118 |
####
|
116 |
####
|
119 |
|
117 |
|
120 |
# Choice of language
|
118 |
# Choice of language
|
121 |
$Language = 'en';
|
119 |
$Language = 'en';
|
122 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
120 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
Line 139... |
Line 137... |
139 |
$l_certif_explain = "Permet l'échange de données sécurisées entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistré sur votre station de consultation, il est possible que des alertes de sécurités soient émises par votre navigateur.<br><br>";
|
137 |
$l_certif_explain = "Permet l'échange de données sécurisées entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistré sur votre station de consultation, il est possible que des alertes de sécurités soient émises par votre navigateur.<br><br>";
|
140 |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
|
138 |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
|
141 |
$l_category = "catégorie :";
|
139 |
$l_category = "catégorie :";
|
142 |
if ((isset ($user[4])) && ($user[4] == "0")) {
|
140 |
if ((isset ($user[4])) && ($user[4] == "0")) {
|
143 |
$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre système.";
|
141 |
$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre système.";
|
- |
|
142 |
if(isset($_GET["url"]))
|
- |
|
143 |
{
|
- |
|
144 |
$l_logout = "<a href=\"http://".$_GET["url"]."\">Ouvrir une session Internet</a>";
|
- |
|
145 |
}
|
- |
|
146 |
else
|
- |
|
147 |
{
|
144 |
$l_logout = "<a href=\"http://www.google.com\">Ouvrir une session Internet</a>";}
|
148 |
$l_logout = "<a href=\"http://www.google.com\">Ouvrir une session Internet</a>";
|
- |
|
149 |
}
|
- |
|
150 |
|
- |
|
151 |
}
|
145 |
else {
|
152 |
else {
|
146 |
if ($user[5] != $user[0]) // authentication exception or not
|
153 |
if ($user[5] != $user[0]) // authentication exception or not
|
147 |
{
|
154 |
{
|
148 |
$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
|
155 |
$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
|
149 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>";
|
156 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>";
|
Line 179... |
Line 186... |
179 |
$l_certif_explain = "O certificado Permiti a troca de dados seguro entre seu computador e o portal Alcasar.<BR>Se este certificado não estiver incorporado no seu computador, alguns alertas de segurança deverá aparecer no navegador.<br><br>";
|
186 |
$l_certif_explain = "O certificado Permiti a troca de dados seguro entre seu computador e o portal Alcasar.<BR>Se este certificado não estiver incorporado no seu computador, alguns alertas de segurança deverá aparecer no navegador.<br><br>";
|
180 |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
|
187 |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
|
181 |
$l_category = "categoria :";
|
188 |
$l_category = "categoria :";
|
182 |
if ((isset ($user[4])) && ($user[4] == "0")) {
|
189 |
if ((isset ($user[4])) && ($user[4] == "0")) {
|
183 |
$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
|
190 |
$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
|
- |
|
191 |
if(isset($_GET["url"]))
|
- |
|
192 |
{
|
- |
|
193 |
$l_logout = "<a href=\"http://".$_GET["url"]."\">Abrir uma conexão de Internet</a>";
|
- |
|
194 |
}
|
- |
|
195 |
else
|
- |
|
196 |
{
|
184 |
$l_logout = "<a href=\"http://www.google.com\">Abrir uma conexão de Internet</a>";}
|
197 |
$l_logout = "<a href=\"http://www.google.com\">Abrir uma conexão de Internet</a>";
|
- |
|
198 |
}
|
- |
|
199 |
|
- |
|
200 |
}
|
185 |
else {
|
201 |
else {
|
186 |
if ($user[5] != $user[0]) // authentication exception or not
|
202 |
if ($user[5] != $user[0]) // authentication exception or not
|
187 |
{
|
203 |
{
|
188 |
$l_logout_explain = "Se desejar, feche a conexão do usuário atual conectado.<br> Usuário conectado : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
204 |
$l_logout_explain = "Se desejar, feche a conexão do usuário atual conectado.<br> Usuário conectado : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
189 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
|
205 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
|
Line 219... |
Line 235... |
219 |
$l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>";
|
235 |
$l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>";
|
220 |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
|
236 |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
|
221 |
$l_category = "category :";
|
237 |
$l_category = "category :";
|
222 |
if ((isset ($user[4])) && ($user[4] == "0")) {
|
238 |
if ((isset ($user[4])) && ($user[4] == "0")) {
|
223 |
$l_logout_explain = "No Internet consultation session is actualy open on your system";
|
239 |
$l_logout_explain = "No Internet consultation session is actualy open on your system";
|
- |
|
240 |
if(isset($_GET["url"]))
|
- |
|
241 |
{
|
- |
|
242 |
$l_logout = "<a href=\"http://".$_GET["url"]."\">Open an Internet session</a>";
|
- |
|
243 |
}
|
- |
|
244 |
else
|
- |
|
245 |
{
|
224 |
$l_logout = "<a href=\"http://www.google.com\">Open an Internet session</a>";}
|
246 |
$l_logout = "<a href=\"http://www.google.com\">Open an Internet session</a>";
|
- |
|
247 |
}
|
- |
|
248 |
|
- |
|
249 |
}
|
225 |
else {
|
250 |
else {
|
226 |
if ($user[5] != $user[0]) // authentication exception or not
|
251 |
if ($user[5] != $user[0]) // authentication exception or not
|
227 |
{
|
252 |
{
|
228 |
$l_logout_explain = "Close the session of the user currently connected.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
253 |
$l_logout_explain = "Close the session of the user currently connected.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
229 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
|
254 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
|
Line 394... |
Line 419... |
394 |
<div id="adm" class="corn">
|
419 |
<div id="adm" class="corn">
|
395 |
<a href="https://<?php echo $hostname; ?>/acc/"><img src=<?php echo $img_rep.''.$img_adm; ?>></a>
|
420 |
<a href="https://<?php echo $hostname; ?>/acc/"><img src=<?php echo $img_rep.''.$img_adm; ?>></a>
|
396 |
</div>
|
421 |
</div>
|
397 |
</div>
|
422 |
</div>
|
398 |
</body>
|
423 |
</body>
|
399 |
</html>
|
424 |
</html>
|
400 |
|
425 |
|