Subversion Repositories ALCASAR

Rev

Rev 2073 | Rev 2100 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2073 Rev 2074
1
<?php
1
<?php
2
# $Id: intercept.php 2073 2016-11-27 21:08:07Z richard $
2
# $Id: intercept.php 2074 2016-11-27 22:09:53Z richard $
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
8
# Help for language translation by B. AUBARD (thanks)
8
# Help for language translation by B. AUBARD (thanks)
9
 
9
 
10
# The contents of this file may be used under the terms of the GNU
10
# The contents of this file may be used under the terms of the GNU
11
# General Public License Version 2, provided that the above copyright
11
# General Public License Version 2, provided that the above copyright
12
# notice and this permission notice is included in all copies or
12
# notice and this permission notice is included in all copies or
13
# substantial portions of the software.
13
# substantial portions of the software.
14
 
14
 
15
# Redirects from CoovaChilli (chilli daemon) :
15
# Redirects from CoovaChilli (chilli daemon) :
16
# Response to login:
16
# Response to login:
17
  # success :	if login successful
17
  # success :	if login successful
18
  # failed :	if login failed
18
  # failed :	if login failed
19
  # logoff :	if logout successful
19
  # logoff :	if logout successful
20
  # already :	if tried to login while already logged in
20
  # already :	if tried to login while already logged in
21
  # notyet :	if not logged in yet
21
  # notyet :	if not logged in yet
22
  # Default :	it was not a form request -> client go to login form
22
  # Default :	it was not a form request -> client go to login form
23
 
23
 
24
/****************************************************************
24
/****************************************************************
25
*			GLOBAL FILE PATHS			*
25
*			GLOBAL FILE PATHS			*
26
*****************************************************************/
26
*****************************************************************/
27
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
27
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
28
define ("DOMAIN_ALLOWED_LIST", "/usr/local/etc/alcasar-uamdomain");
28
define ("DOMAIN_ALLOWED_LIST", "/usr/local/etc/alcasar-uamdomain");
29
 
29
 
30
/****************************************************************
30
/****************************************************************
31
*			FILE reading test			*
31
*			FILE reading test			*
32
*****************************************************************/
32
*****************************************************************/
33
$conf_files=array(CONF_FILE,DOMAIN_ALLOWED_LIST);
33
$conf_files=array(CONF_FILE,DOMAIN_ALLOWED_LIST);
34
foreach ($conf_files as $file){
34
foreach ($conf_files as $file){
35
	if (!file_exists($file)){
35
	if (!file_exists($file)){
36
		exit("Fichier ".$file." non présent");
36
		exit("Fichier ".$file." non présent");
37
	}
37
	}
38
	if (!is_readable($file)){
38
	if (!is_readable($file)){
39
		exit("Vous n'avez pas les droits de lecture sur le fichier ".$file);
39
		exit("Vous n'avez pas les droits de lecture sur le fichier ".$file);
40
	}
40
	}
41
}
41
}
42
/****************************************************************
42
/****************************************************************
43
*			Read CONF_FILE				*
43
*			Read CONF_FILE				*
44
*****************************************************************/
44
*****************************************************************/
45
$ouvre=fopen(CONF_FILE,"r");
45
$ouvre=fopen(CONF_FILE,"r");
46
if ($ouvre){
46
if ($ouvre){
47
	while (!feof ($ouvre))
47
	while (!feof ($ouvre))
48
	{
48
	{
49
		$tampon = fgets($ouvre, 4096);
49
		$tampon = fgets($ouvre, 4096);
50
		if (strpos($tampon,"=")!==false){
50
		if (strpos($tampon,"=")!==false){
51
			$tmp = explode("=",$tampon);
51
			$tmp = explode("=",$tampon);
52
			$conf[$tmp[0]] = $tmp[1];
52
			$conf[$tmp[0]] = $tmp[1];
53
		}
53
		}
54
	}
54
	}
55
}else{
55
}else{
56
	exit("Erreur d'ouverture du fichier ".CONF_FILE);
56
	exit("Erreur d'ouverture du fichier ".CONF_FILE);
57
}
57
}
58
fclose($ouvre);
58
fclose($ouvre);
59
$organisme = trim($conf["ORGANISM"]);
59
$organisme = trim($conf["ORGANISM"]);
60
 
60
 
61
# Shared secret used to encrypt password with coova.
61
# Shared secret used to encrypt password with coova.
62
$uamsecret = "";
62
$uamsecret = "";
63
 
63
 
64
# URL loaded after success authenticates (let blank for browser defaults)
64
# URL loaded after success authenticates (let blank for browser defaults)
65
$adminurl = "";
65
$adminurl = "";
66
 
66
 
67
# Our own path
67
# Our own path
68
$loginpath	= $_SERVER['PHP_SELF'];
68
$loginpath	= $_SERVER['PHP_SELF'];
69
$alcasarpath	= "http://alcasar.".trim($conf["DOMAIN"]);
69
$alcasarpath	= "http://alcasar.".trim($conf["DOMAIN"]);
70
$statuspath	= $alcasarpath."/status.php";
70
$statuspath	= $alcasarpath."/status.php";
71
$debug		= false;
71
$debug		= false;
72
 
72
 
73
# Choice of language
73
# Choice of language
74
$Language = 'en';
74
$Language = 'en';
75
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
75
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
76
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
76
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
77
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
77
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
78
if($Language == 'es'){
78
if($Language == 'es'){
79
  $l_ChilliError	= "La autenticación debe ser un éxito a través del servicio de portal cautivo.";
79
  $l_ChilliError	= "La autenticación debe ser un éxito a través del servicio de portal cautivo.";
80
  $l_login		= "El éxito de la autenticación.<HR>Cierre esta ventana interrumpte la sesion.";
80
  $l_login		= "El éxito de la autenticación.<HR>Cierre esta ventana interrumpte la sesion.";
81
  $l_logout		= "Conexión de cierre";
81
  $l_logout		= "Conexión de cierre";
82
  $l_loginfailed	= "Error de autenticación";
82
  $l_loginfailed	= "Error de autenticación";
83
  $l_loggingin		= "Identificación en el portal cautivo";
83
  $l_loggingin		= "Identificación en el portal cautivo";
84
  $l_loggedcont		= "Control de Acceso";
84
  $l_loggedcont		= "Control de Acceso";
85
  $l_loggedout		= "Su sesión se cierra";
85
  $l_loggedout		= "Su sesión se cierra";
86
  $l_user		= "Usuario";
86
  $l_user		= "Usuario";
87
  $l_password		= "Contraseña";
87
  $l_password		= "Contraseña";
88
  $l_wait		= "Por favor, espere un momento ...";
88
  $l_wait		= "Por favor, espere un momento ...";
89
  $l_onlinetime		= "Tiempo de conexión:";
89
  $l_onlinetime		= "Tiempo de conexión:";
90
  $l_remainingtime	= "Desconexión en:";
90
  $l_remainingtime	= "Desconexión en:";
91
  $l_encrypted		= "La apertura debe usar conexión cifrada";
91
  $l_encrypted		= "La apertura debe usar conexión cifrada";
92
  $l_boutonO		= "Autenticación";
92
  $l_boutonO		= "Autenticación";
93
  $l_boutonF		= "Cerrar";
93
  $l_boutonF		= "Cerrar";
94
  $l_loggedin_stringl1	= "Information System Security";
94
  $l_loggedin_stringl1	= "Information System Security";
95
  $l_loggedin_stringl2	= "El portal fue creado reglamentos para garantizar la trazabilidad, la rendición de cuentas y el no repudio de las conexiones.";
95
  $l_loggedin_stringl2	= "El portal fue creado reglamentos para garantizar la trazabilidad, la rendición de cuentas y el no repudio de las conexiones.";
96
  $l_loggedin_stringl3	= "Su actividad en la red es registrada, de conformidad con la privacidad.";
96
  $l_loggedin_stringl3	= "Su actividad en la red es registrada, de conformidad con la privacidad.";
97
  $l_loggedin_stringl4	= "Los datos registrados pueden ser capaces de ser operado por una autoridad judicial en el curso de una investigación.";
97
  $l_loggedin_stringl4	= "Los datos registrados pueden ser capaces de ser operado por una autoridad judicial en el curso de una investigación.";
98
  $l_loggedin_stringl5	= "Estos datos se eliminan automáticamente después de un año.";
98
  $l_loggedin_stringl5	= "Estos datos se eliminan automáticamente después de un año.";
99
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
99
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
100
  $l_loggedout_string	= "Cerrar sesión hizo portal cautivo!";
100
  $l_loggedout_string	= "Cerrar sesión hizo portal cautivo!";
101
  $l_reply_1		= "Your daily connexion time has been reached";
101
  $l_reply_1		= "Your daily connexion time has been reached";
102
  $l_reply_2		= "Your monthly connexion time has been reached";
102
  $l_reply_2		= "Your monthly connexion time has been reached";
103
  $l_reply_3		= "You try to connect outside of your allowed timespan";
103
  $l_reply_3		= "You try to connect outside of your allowed timespan";
104
  $l_reply_4		= "your account expired";
104
  $l_reply_4		= "your account expired";
105
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
105
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
106
  $l_reply_6		= "Your authorized connexion time has been reached";
106
  $l_reply_6		= "Your authorized connexion time has been reached";
107
  $l_online_time	= "Tiempo en linea";
107
  $l_online_time	= "Tiempo en linea";
108
  $l_remaining_time	= "Tiempo restante";
108
  $l_remaining_time	= "Tiempo restante";
109
  $l_uam_domain		= "Sitios web autorizados : ";
109
  $l_uam_domain		= "Sitios web autorizados : ";
110
  $l_autoregistration   = "Registo autom&aacute;tico";}
110
  $l_autoregistration   = "Registo autom&aacute;tico";}
111
else if ($Language == 'pt'){
111
else if ($Language == 'pt'){
112
  $l_ChilliError	= "A autenticação precisa ser bem sucedida através do portal.";
112
  $l_ChilliError	= "A autenticação precisa ser bem sucedida através do portal.";
113
  $l_login		= "Sucesso na autenticação.<HR>Matenha esse pop-up apenas minimizado para não interromper a conexão";
113
  $l_login		= "Sucesso na autenticação.<HR>Matenha esse pop-up apenas minimizado para não interromper a conexão";
114
  $l_logout		= "Encerrar conexão";
114
  $l_logout		= "Encerrar conexão";
115
  $l_loginfailed	= "Falha na autenticação";
115
  $l_loginfailed	= "Falha na autenticação";
116
  $l_loggingin		= "Identificação do portal cativo";
116
  $l_loggingin		= "Identificação do portal cativo";
117
  $l_loggedcont		= "Controle de acesso";
117
  $l_loggedcont		= "Controle de acesso";
118
  $l_loggedout		= "Sua sessão foi fechada";
118
  $l_loggedout		= "Sua sessão foi fechada";
119
  $l_user		= "Usuário";
119
  $l_user		= "Usuário";
120
  $l_password		= "Senha";
120
  $l_password		= "Senha";
121
  $l_wait		= "Por favor, aguarde um momento ...";
121
  $l_wait		= "Por favor, aguarde um momento ...";
122
  $l_onlinetime		= "Tempo de conexão:";
122
  $l_onlinetime		= "Tempo de conexão:";
123
  $l_remainingtime	= "Desconectado em:";
123
  $l_remainingtime	= "Desconectado em:";
124
  $l_encrypted		= "A conexão com o portal deve ser criptografada";
124
  $l_encrypted		= "A conexão com o portal deve ser criptografada";
125
  $l_boutonO		= "Autenticação";
125
  $l_boutonO		= "Autenticação";
126
  $l_boutonF		= "Fechar";
126
  $l_boutonF		= "Fechar";
127
  $l_loggedin_stringl1	= "Sistema de Informação e segurança";
127
  $l_loggedin_stringl1	= "Sistema de Informação e segurança";
128
  $l_loggedin_stringl2	= "Este controle foi criado para garantir acesso seguro.";
128
  $l_loggedin_stringl2	= "Este controle foi criado para garantir acesso seguro.";
129
  $l_loggedin_stringl3	= "A autenticação será criptografada em 256 bits, impedindo captura por escâner de rede.";
129
  $l_loggedin_stringl3	= "A autenticação será criptografada em 256 bits, impedindo captura por escâner de rede.";
130
  $l_loggedin_stringl4	= "Sua atividade na Internet será resguardada de acordo com os regulamentos da lei.";
130
  $l_loggedin_stringl4	= "Sua atividade na Internet será resguardada de acordo com os regulamentos da lei.";
131
  $l_loggedin_stringl5	= "Mantenha o popup da conexão minimizado para não interromper a cessão.";
131
  $l_loggedin_stringl5	= "Mantenha o popup da conexão minimizado para não interromper a cessão.";
132
  $l_loggedin_stringl6	= "Clique <a href='$alcasarpath'>aqui</a> para alterar sua senha, instalar certificado ou sair do portal.";
132
  $l_loggedin_stringl6	= "Clique <a href='$alcasarpath'>aqui</a> para alterar sua senha, instalar certificado ou sair do portal.";
133
  $l_loggedout_string	= "desconexão do portal cativo";
133
  $l_loggedout_string	= "desconexão do portal cativo";
134
  $l_reply_1		= "Seu tempo de conexão diária foi finalizado";
134
  $l_reply_1		= "Seu tempo de conexão diária foi finalizado";
135
  $l_reply_2		= "Seu tempo de conexão mensal foi finalizado";
135
  $l_reply_2		= "Seu tempo de conexão mensal foi finalizado";
136
  $l_reply_3		= "Você tenta conectar-se fora do seu período de tempo permitido";
136
  $l_reply_3		= "Você tenta conectar-se fora do seu período de tempo permitido";
137
  $l_reply_4		= "Sua conta expirou";
137
  $l_reply_4		= "Sua conta expirou";
138
  $l_reply_5		= "Você atingiu o número máximo de logins simultâneos";
138
  $l_reply_5		= "Você atingiu o número máximo de logins simultâneos";
139
  $l_reply_6		= "Seu tempo de conexão autorizada finalizou";
139
  $l_reply_6		= "Seu tempo de conexão autorizada finalizou";
140
  $l_online_time	= "Tempo Online";
140
  $l_online_time	= "Tempo Online";
141
  $l_remaining_time	= "Tempo restante";
141
  $l_remaining_time	= "Tempo restante";
142
  $l_uam_domain		= "Sites autorizados : ";
142
  $l_uam_domain		= "Sites autorizados : ";
143
  $l_autoregistration   = "Registo autom&aacute;tico";}
143
  $l_autoregistration   = "Registo autom&aacute;tico";}
144
else if ($Language == 'zn'){
144
else if ($Language == 'zh'){
145
  $l_ChilliError	= "验证必须通过强制门户服务";
145
  $l_ChilliError	= "验证必须通过强制门户服务";
146
  $l_login		= "验证成功<HR>关闭此窗口中断连接";
146
  $l_login		= "验证成功<HR>关闭此窗口中断连接";
147
  $l_logout		= "关闭连接";
147
  $l_logout		= "关闭连接";
148
  $l_loginfailed	= "验证失败";
148
  $l_loginfailed	= "验证失败";
149
  $l_loggingin		= "强制门户身份识别";
149
  $l_loggingin		= "强制门户身份识别";
150
  $l_loggedcont		= "访问控制";
150
  $l_loggedcont		= "访问控制";
151
  $l_loggedout		= "您的连接已关闭";
151
  $l_loggedout		= "您的连接已关闭";
152
  $l_user		= "用户名";
152
  $l_user		= "用户名";
153
  $l_password		= "密码";
153
  $l_password		= "密码";
154
  $l_wait		= "请等待 ...";
154
  $l_wait		= "请等待 ...";
155
  $l_onlinetime		= "连接时间";
155
  $l_onlinetime		= "连接时间";
156
  $l_remainingtime	= "断开连接于";
156
  $l_remainingtime	= "断开连接于";
157
  $l_encrypted		= "与门户的连接必须加密";
157
  $l_encrypted		= "与门户的连接必须加密";
158
  $l_boutonO		= "验证";
158
  $l_boutonO		= "验证";
159
  $l_boutonF		= "关闭";
159
  $l_boutonF		= "关闭";
160
  $l_loggedin_stringl1	= "信息系统安全";
160
  $l_loggedin_stringl1	= "信息系统安全";
161
  $l_loggedin_stringl2	= "这种控制实施以法定保证可追溯性,可归罪性和连接的不否认性.";
161
  $l_loggedin_stringl2	= "这种控制实施以法定保证可追溯性,可归罪性和连接的不否认性.";
162
  $l_loggedin_stringl3	= "您的网络活动是私密登记的.";
162
  $l_loggedin_stringl3	= "您的网络活动是私密登记的.";
163
  $l_loggedin_stringl4	= "记录的数据能被司法机关在调查中操作使用.";
163
  $l_loggedin_stringl4	= "记录的数据能被司法机关在调查中操作使用.";
164
  $l_loggedin_stringl5	= "这些数据将在一年后自动删除.";
164
  $l_loggedin_stringl5	= "这些数据将在一年后自动删除.";
165
  $l_loggedin_stringl6	= "点击 <a href='$alcasarpath'> 这里 </a> 修改密码或安装浏览器安全证书";
165
  $l_loggedin_stringl6	= "点击 <a href='$alcasarpath'> 这里 </a> 修改密码或安装浏览器安全证书";
166
  $l_loggedout_string	= "强制网络门户连接已断开";
166
  $l_loggedout_string	= "强制网络门户连接已断开";
167
  $l_reply_1		= "您已经达到每日连接时间";
167
  $l_reply_1		= "您已经达到每日连接时间";
168
  $l_reply_2		= "您已经达到每月连接时间";
168
  $l_reply_2		= "您已经达到每月连接时间";
169
  $l_reply_3		= "您尝试在授权时间以外连接";
169
  $l_reply_3		= "您尝试在授权时间以外连接";
170
  $l_reply_4		= "您的账号已过期";
170
  $l_reply_4		= "您的账号已过期";
171
  $l_reply_5		= "您已经达到同时连接的最大数量";
171
  $l_reply_5		= "您已经达到同时连接的最大数量";
172
  $l_reply_6		= "已经到达您的允许连接时间";
172
  $l_reply_6		= "已经到达您的允许连接时间";
173
  $l_online_time	= "在线时间";
173
  $l_online_time	= "在线时间";
174
  $l_remaining_time	= "剩余时间";
174
  $l_remaining_time	= "剩余时间";
175
  $l_uam_domain		= "授权网站 : ";
175
  $l_uam_domain		= "授权网站 : ";
176
  $l_autoregistration   = "短信注册";}
176
  $l_autoregistration   = "短信注册";}
177
else if($Language == 'de'){
177
else if($Language == 'de'){
178
  $l_ChilliError	= "Die Authentifizierung ist erfolgreich durch die Nutzung des Portals erfolgt.";
178
  $l_ChilliError	= "Die Authentifizierung ist erfolgreich durch die Nutzung des Portals erfolgt.";
179
  $l_login		= "Erfolgreiche Authentifizierung.<HR>Schlißen dieses fensters unterbricht die sitzung";
179
  $l_login		= "Erfolgreiche Authentifizierung.<HR>Schlißen dieses fensters unterbricht die sitzung";
180
  $l_logout		= "Beenden der Verbindung";
180
  $l_logout		= "Beenden der Verbindung";
181
  $l_loginfailed	= "Authentifizierungsfehler Eigenverbrauch";
181
  $l_loginfailed	= "Authentifizierungsfehler Eigenverbrauch";
182
  $l_loggingin		= "Kennzeichnung auf dem Eigenverbrauch";
182
  $l_loggingin		= "Kennzeichnung auf dem Eigenverbrauch";
183
  $l_loggedcont		= "Zutrittskontrolle";
183
  $l_loggedcont		= "Zutrittskontrolle";
184
  $l_loggedout		= "Ihre Sitzung ist geschlossen";
184
  $l_loggedout		= "Ihre Sitzung ist geschlossen";
185
  $l_user		= "Benutzer";
185
  $l_user		= "Benutzer";
186
  $l_password		= "Passwort";
186
  $l_password		= "Passwort";
187
  $l_wait		= "Bitte warten Sie einen Moment ...";
187
  $l_wait		= "Bitte warten Sie einen Moment ...";
188
  $l_onlinetime		= "Online-Zeit:";
188
  $l_onlinetime		= "Online-Zeit:";
189
  $l_remainingtime	= "Abmelden:";
189
  $l_remainingtime	= "Abmelden:";
190
  $l_encrypted		= "Die Öffnung muß der Anschluß Zahlen";
190
  $l_encrypted		= "Die Öffnung muß der Anschluß Zahlen";
191
  $l_boutonO		= "Authentifizierung";
191
  $l_boutonO		= "Authentifizierung";
192
  $l_boutonF		= "Schließen";
192
  $l_boutonF		= "Schließen";
193
  $l_loggedin_stringl1	= "Information System Security";
193
  $l_loggedin_stringl1	= "Information System Security";
194
  $l_loggedin_stringl2	= "Dieses Portal wurde eingerichtet, um ordnungsgemäß die Rückverfolgbarkeit, der Zurechenbarkeit und der Nicht-Anerkennung der Verbindungen.";
194
  $l_loggedin_stringl2	= "Dieses Portal wurde eingerichtet, um ordnungsgemäß die Rückverfolgbarkeit, der Zurechenbarkeit und der Nicht-Anerkennung der Verbindungen.";
195
  $l_loggedin_stringl3	= "Ihre Tätigkeit im Netzwerk registriert ist nach Schutz der Privatsphäre.";
195
  $l_loggedin_stringl3	= "Ihre Tätigkeit im Netzwerk registriert ist nach Schutz der Privatsphäre.";
196
  $l_loggedin_stringl4	= "Die gespeicherten Daten nicht pouront genutzt werden, dass von einer Justizbehörde im Rahmen einer Untersuchung.";
196
  $l_loggedin_stringl4	= "Die gespeicherten Daten nicht pouront genutzt werden, dass von einer Justizbehörde im Rahmen einer Untersuchung.";
197
  $l_loggedin_stringl5	= "Diese Daten werden automatisch gelöscht nach einem Jahr.";
197
  $l_loggedin_stringl5	= "Diese Daten werden automatisch gelöscht nach einem Jahr.";
198
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
198
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
199
  $l_loggedout_string	= "Trennung des Portals erfolgt Gefangener!";
199
  $l_loggedout_string	= "Trennung des Portals erfolgt Gefangener!";
200
  $l_reply_1		= "Your daily connexion time has been reached";
200
  $l_reply_1		= "Your daily connexion time has been reached";
201
  $l_reply_2		= "Your monthly connexion time has been reached";
201
  $l_reply_2		= "Your monthly connexion time has been reached";
202
  $l_reply_3		= "You try to connect outside of your allowed timespan";
202
  $l_reply_3		= "You try to connect outside of your allowed timespan";
203
  $l_reply_4		= "your account expired";
203
  $l_reply_4		= "your account expired";
204
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
204
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
205
  $l_reply_6		= "Your authorized connexion time has been reached";
205
  $l_reply_6		= "Your authorized connexion time has been reached";
206
  $l_online_time	= "Online-zeit";
206
  $l_online_time	= "Online-zeit";
207
  $l_remaining_time	= "Restzeit";
207
  $l_remaining_time	= "Restzeit";
208
  $l_uam_domain		= "Autorisierten websites : ";
208
  $l_uam_domain		= "Autorisierten websites : ";
209
  $l_autoregistration   = "Automatische registrierung";}
209
  $l_autoregistration   = "Automatische registrierung";}
210
else if($Language == 'nl'){
210
else if($Language == 'nl'){
211
  $l_ChilliError	= "De authenticatie moet een succes worden via de captive portal dienst.";
211
  $l_ChilliError	= "De authenticatie moet een succes worden via de captive portal dienst.";
212
  $l_login		= "Succesvolle authenticatie.<HR>Dit venster te sluiten onderbreekt uw sessie.";
212
  $l_login		= "Succesvolle authenticatie.<HR>Dit venster te sluiten onderbreekt uw sessie.";
213
  $l_logout		= "Slotkoers verbinding";
213
  $l_logout		= "Slotkoers verbinding";
214
  $l_loginfailed	= "Authenticatie mislukt";
214
  $l_loginfailed	= "Authenticatie mislukt";
215
  $l_loggingin		= "Identificatie van de captive-portaal";
215
  $l_loggingin		= "Identificatie van de captive-portaal";
216
  $l_loggedcont		= "toegangscontrole";
216
  $l_loggedcont		= "toegangscontrole";
217
  $l_loggedout		= "Uw sessie is gesloten";
217
  $l_loggedout		= "Uw sessie is gesloten";
218
  $l_user		= "Gebruiker";
218
  $l_user		= "Gebruiker";
219
  $l_password		= "Wachtwoord";
219
  $l_password		= "Wachtwoord";
220
  $l_wait		= "Wacht een moment ...";
220
  $l_wait		= "Wacht een moment ...";
221
  $l_onlinetime		= "Sluit tijd:";
221
  $l_onlinetime		= "Sluit tijd:";
222
  $l_remainingtime	= "Verbreking in:";
222
  $l_remainingtime	= "Verbreking in:";
223
  $l_encrypted		= "De opening moet gebruiken gecodeerde verbinding";
223
  $l_encrypted		= "De opening moet gebruiken gecodeerde verbinding";
224
  $l_boutonO		= "Authenticatie";
224
  $l_boutonO		= "Authenticatie";
225
  $l_boutonF		= "Sluiten";
225
  $l_boutonF		= "Sluiten";
226
  $l_loggedin_stringl1	= "Information System Security";
226
  $l_loggedin_stringl1	= "Information System Security";
227
  $l_loggedin_stringl2	= "Het portaal werd opgericht verordeningen om de traceerbaarheid, verantwoordelijkheid en onloochenbaarheid van de verbindingen.";
227
  $l_loggedin_stringl2	= "Het portaal werd opgericht verordeningen om de traceerbaarheid, verantwoordelijkheid en onloochenbaarheid van de verbindingen.";
228
  $l_loggedin_stringl3	= "Uw activiteit op het netwerk is geregistreerd in overeenstemming met de persoonlijke levenssfeer.";
228
  $l_loggedin_stringl3	= "Uw activiteit op het netwerk is geregistreerd in overeenstemming met de persoonlijke levenssfeer.";
229
  $l_loggedin_stringl4	= "De geregistreerde gegevens kunnen worden kunnen worden bediend door een rechterlijke instantie in de loop van een onderzoek.";
229
  $l_loggedin_stringl4	= "De geregistreerde gegevens kunnen worden kunnen worden bediend door een rechterlijke instantie in de loop van een onderzoek.";
230
  $l_loggedin_stringl5	= "Deze gegevens worden automatisch verwijderd na een jaar.";
230
  $l_loggedin_stringl5	= "Deze gegevens worden automatisch verwijderd na een jaar.";
231
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
231
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
232
  $l_loggedout_string	= "Logout gemaakt intern portaal!";
232
  $l_loggedout_string	= "Logout gemaakt intern portaal!";
233
  $l_reply_1 		= "Your daily connexion time has been reached";
233
  $l_reply_1 		= "Your daily connexion time has been reached";
234
  $l_reply_2		= "Your monthly connexion time has been reached";
234
  $l_reply_2		= "Your monthly connexion time has been reached";
235
  $l_reply_3		= "You try to connect outside of your allowed timespan";
235
  $l_reply_3		= "You try to connect outside of your allowed timespan";
236
  $l_reply_4		= "your account expired";
236
  $l_reply_4		= "your account expired";
237
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
237
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
238
  $l_reply_6		= "Your authorized connexion time has been reached";
238
  $l_reply_6		= "Your authorized connexion time has been reached";
239
  $l_online_time	= "Online tijd";
239
  $l_online_time	= "Online tijd";
240
  $l_remaining_time	= "Reterende tijd";
240
  $l_remaining_time	= "Reterende tijd";
241
  $l_uam_domain		= "Geautoriseerde website : ";
241
  $l_uam_domain		= "Geautoriseerde website : ";
242
  $l_autoregistration   = "Automatische registratie";}
242
  $l_autoregistration   = "Automatische registratie";}
243
else if($Language == 'fr'){
243
else if($Language == 'fr'){
244
  $l_ChilliError	= "L'authentification doit être réussie sur le portail captif.";
244
  $l_ChilliError	= "L'authentification doit être réussie sur le portail captif.";
245
  $l_login		= "Authentification réussie.<HR>La fermeture de cette fenêtre interrompt votre session.";
245
  $l_login		= "Authentification réussie.<HR>La fermeture de cette fenêtre interrompt votre session.";
246
  $l_logout		= "Fermeture de la session";
246
  $l_logout		= "Fermeture de la session";
247
  $l_loginfailed	= "Echec d'authentification";
247
  $l_loginfailed	= "Echec d'authentification";
248
  $l_loggingin		= "Identification sur le portail captif";
248
  $l_loggingin		= "Identification sur le portail captif";
249
  $l_loggedcont		= "Contrôle d'accès";
249
  $l_loggedcont		= "Contrôle d'accès";
250
  $l_loggedout		= "Votre session est fermée";
250
  $l_loggedout		= "Votre session est fermée";
251
  $l_user		= "Identifiant";
251
  $l_user		= "Identifiant";
252
  $l_password		= "Mot de passe";
252
  $l_password		= "Mot de passe";
253
  $l_wait		= "Patientez un instant ...";
253
  $l_wait		= "Patientez un instant ...";
254
  $l_onlinetime		= "Temps de connexion:";
254
  $l_onlinetime		= "Temps de connexion:";
255
  $l_remainingtime	= "Deconnexion dans :";
255
  $l_remainingtime	= "Deconnexion dans :";
256
  $l_encrypted		= "La connexion avec le portail doit être chiffrée";
256
  $l_encrypted		= "La connexion avec le portail doit être chiffrée";
257
  $l_boutonO		= "Authentification";
257
  $l_boutonO		= "Authentification";
258
  $l_boutonF		= "Fermer";
258
  $l_boutonF		= "Fermer";
259
  $l_loggedin_stringl1	= "Sécurité des Systèmes d'Information";
259
  $l_loggedin_stringl1	= "Sécurité des Systèmes d'Information";
260
  $l_loggedin_stringl2	= "Ce contrôle a été mis en place pour assurer réglementairement la traçabilité, l'imputabilité et la non-répudiation des connexions.";
260
  $l_loggedin_stringl2	= "Ce contrôle a été mis en place pour assurer réglementairement la traçabilité, l'imputabilité et la non-répudiation des connexions.";
261
  $l_loggedin_stringl3	= "Votre activité sur le réseau est enregistrée conformément au respect de la vie privée.";
261
  $l_loggedin_stringl3	= "Votre activité sur le réseau est enregistrée conformément au respect de la vie privée.";
262
  $l_loggedin_stringl4	= "Les données enregistrées ne pourront être exploitées que par une autorité judiciaire dans le cadre d'une enquête.";
262
  $l_loggedin_stringl4	= "Les données enregistrées ne pourront être exploitées que par une autorité judiciaire dans le cadre d'une enquête.";
263
  $l_loggedin_stringl5	= "Ces données seront automatiquement supprimées au bout d'un an.";
263
  $l_loggedin_stringl5	= "Ces données seront automatiquement supprimées au bout d'un an.";
264
  $l_loggedin_stringl6	= "Cliquez <a href='$alcasarpath'>ici</a> pour changer votre mot de passe ou pour intégrer le certificat de sécurité à votre navigateur";
264
  $l_loggedin_stringl6	= "Cliquez <a href='$alcasarpath'>ici</a> pour changer votre mot de passe ou pour intégrer le certificat de sécurité à votre navigateur";
265
  $l_loggedout_string	= "Déconnexion du portail captif effectuée !";
265
  $l_loggedout_string	= "Déconnexion du portail captif effectuée !";
266
  $l_reply_1		= "Votre durée de connexion journalière a été atteinte";
266
  $l_reply_1		= "Votre durée de connexion journalière a été atteinte";
267
  $l_reply_2		= "Votre durée de connexion mensuelle a été atteinte";
267
  $l_reply_2		= "Votre durée de connexion mensuelle a été atteinte";
268
  $l_reply_3		= "Vous tentez de vous connecter en dehors de votre période autorisée";
268
  $l_reply_3		= "Vous tentez de vous connecter en dehors de votre période autorisée";
269
  $l_reply_4		= "Votre compte a expiré";
269
  $l_reply_4		= "Votre compte a expiré";
270
  $l_reply_5		= "Vous avez atteint le nombre maximum de connexions simultanées";
270
  $l_reply_5		= "Vous avez atteint le nombre maximum de connexions simultanées";
271
  $l_reply_6		= "Votre durée de connexion autorisée a été atteinte";
271
  $l_reply_6		= "Votre durée de connexion autorisée a été atteinte";
272
  $l_online_time	= "Temps de connexion";
272
  $l_online_time	= "Temps de connexion";
273
  $l_remaining_time	= "Temps restant";
273
  $l_remaining_time	= "Temps restant";
274
  $l_uam_domain		= "Sites autorisés : ";
274
  $l_uam_domain		= "Sites autorisés : ";
275
  $l_autoregistration	= "Auto enregistrement (sms)";}
275
  $l_autoregistration	= "Auto enregistrement (sms)";}
276
else{
276
else{
277
  $l_ChilliError	= "The authentication must be successful through the captive portal service.";
277
  $l_ChilliError	= "The authentication must be successful through the captive portal service.";
278
  $l_login		= "Successful authentication.<HR>Closing this window interrupts your session";
278
  $l_login		= "Successful authentication.<HR>Closing this window interrupts your session";
279
  $l_logout		= "Closing connection";
279
  $l_logout		= "Closing connection";
280
  $l_loginfailed	= "Authentication Failed";
280
  $l_loginfailed	= "Authentication Failed";
281
  $l_loggingin		= "Identification on the captive portal";
281
  $l_loggingin		= "Identification on the captive portal";
282
  $l_loggedcont		= "Access Control";
282
  $l_loggedcont		= "Access Control";
283
  $l_loggedout		= "Your session is closed";
283
  $l_loggedout		= "Your session is closed";
284
  $l_user		= "User";
284
  $l_user		= "User";
285
  $l_password		= "Password";
285
  $l_password		= "Password";
286
  $l_wait		= "Please wait a moment ...";
286
  $l_wait		= "Please wait a moment ...";
287
  $l_onlinetime		= "Connect time:";
287
  $l_onlinetime		= "Connect time:";
288
  $l_remainingtime	= "Disconnection in:";
288
  $l_remainingtime	= "Disconnection in:";
289
  $l_encrypted		= "The connection with the portal must be encrypted";
289
  $l_encrypted		= "The connection with the portal must be encrypted";
290
  $l_boutonO		= "Authentication";
290
  $l_boutonO		= "Authentication";
291
  $l_boutonF		= "Close";
291
  $l_boutonF		= "Close";
292
  $l_loggedin_stringl1	= "Information System Security";
292
  $l_loggedin_stringl1	= "Information System Security";
293
  $l_loggedin_stringl2	= "That control was set up regulations to ensure traceability, accountability and non-repudiation of connections.";
293
  $l_loggedin_stringl2	= "That control was set up regulations to ensure traceability, accountability and non-repudiation of connections.";
294
  $l_loggedin_stringl3	= "Your activity on the network is registered in accordance with privacy.";
294
  $l_loggedin_stringl3	= "Your activity on the network is registered in accordance with privacy.";
295
  $l_loggedin_stringl4	= "The recorded data can be able to be operated by a judicial authority in the course of an investigation.";
295
  $l_loggedin_stringl4	= "The recorded data can be able to be operated by a judicial authority in the course of an investigation.";
296
  $l_loggedin_stringl5	= "These data will be automatically deleted after one year.";
296
  $l_loggedin_stringl5	= "These data will be automatically deleted after one year.";
297
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
297
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
298
  $l_loggedout_string	= "Disconnection of the captive portal made";
298
  $l_loggedout_string	= "Disconnection of the captive portal made";
299
  $l_reply_1		= "Your daily connexion time has been reached";
299
  $l_reply_1		= "Your daily connexion time has been reached";
300
  $l_reply_2		= "Your monthly connexion time has been reached";
300
  $l_reply_2		= "Your monthly connexion time has been reached";
301
  $l_reply_3		= "You try to connect outside of your allowed timespan";
301
  $l_reply_3		= "You try to connect outside of your allowed timespan";
302
  $l_reply_4		= "your account expired";
302
  $l_reply_4		= "your account expired";
303
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
303
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
304
  $l_reply_6		= "Your authorized connexion time has been reached";
304
  $l_reply_6		= "Your authorized connexion time has been reached";
305
  $l_online_time	= "Online time";
305
  $l_online_time	= "Online time";
306
  $l_remaining_time	= "Remaining time";
306
  $l_remaining_time	= "Remaining time";
307
  $l_uam_domain		= "Authorized websites : ";
307
  $l_uam_domain		= "Authorized websites : ";
308
  $l_autoregistration	= "Auto registration (sms)";
308
  $l_autoregistration	= "Auto registration (sms)";
309
}
309
}
310
 
310
 
311
# If https not use, tell it's wrong
311
# If https not use, tell it's wrong
312
if (!(isset($_SERVER['HTTPS'])&&($_SERVER['HTTPS'] == 'on'))) {
312
if (!(isset($_SERVER['HTTPS'])&&($_SERVER['HTTPS'] == 'on'))) {
313
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
313
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
314
<html>
314
<html>
315
<head>
315
<head>
316
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
316
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
317
  <title>$l_loggedcont</title>
317
  <title>$l_loggedcont</title>
318
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
318
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
319
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
319
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
320
</head>
320
</head>
321
<body bgColor = 'white'>
321
<body bgColor = 'white'>
322
  <h1 style=\"text-align: center;\">$l_loginfailed</h1>
322
  <h1 style=\"text-align: center;\">$l_loginfailed</h1>
323
  <center>$l_encrypted</center>
323
  <center>$l_encrypted</center>
324
</body>
324
</body>
325
</html>";
325
</html>";
326
    exit(0);
326
    exit(0);
327
}
327
}
328
 
328
 
329
# Read form parameters which we care about
329
# Read form parameters which we care about
330
# avoid the "user as a MAC address" attempts
330
# avoid the "user as a MAC address" attempts
331
if ((isset($_POST['UserName'])) && (preg_match('/^([0-9A-F]{2}-){5}[0-9A-F]{2}$/',$_POST['UserName'])!=1)){
331
if ((isset($_POST['UserName'])) && (preg_match('/^([0-9A-F]{2}-){5}[0-9A-F]{2}$/',$_POST['UserName'])!=1)){
332
				$username	= $_POST['UserName'];} else {$username="";}
332
				$username	= $_POST['UserName'];} else {$username="";}
333
if (isset($_POST['Password'])){	$password	= $_POST['Password'];} else {$password="";}
333
if (isset($_POST['Password'])){	$password	= $_POST['Password'];} else {$password="";}
334
if (isset($_POST['challenge'])){$challenge	= $_POST['challenge'];} else {$challenge="";}
334
if (isset($_POST['challenge'])){$challenge	= $_POST['challenge'];} else {$challenge="";}
335
if (isset($_POST['button'])){	$button		= $_POST['button'];} else { $button="";}
335
if (isset($_POST['button'])){	$button		= $_POST['button'];} else { $button="";}
336
//if (isset($_POST['logout'])){	$logout		= $_POST['logout'];} else {$logout="";}
336
//if (isset($_POST['logout'])){	$logout		= $_POST['logout'];} else {$logout="";}
337
//if (isset($_POST['prelogin'])){	$prelogin	= $_POST['prelogin'];} else {$prelogin="";}
337
//if (isset($_POST['prelogin'])){	$prelogin	= $_POST['prelogin'];} else {$prelogin="";}
338
if (isset($_POST['res'])){		$res		= $_POST['res'];} else {$res="";}
338
if (isset($_POST['res'])){		$res		= $_POST['res'];} else {$res="";}
339
if (isset($_POST['uamip'])){	$uamip		= $_POST['uamip'];} else {$uamip="";}
339
if (isset($_POST['uamip'])){	$uamip		= $_POST['uamip'];} else {$uamip="";}
340
if (isset($_POST['uamport'])){	$uamport	= $_POST['uamport'];} else {$uamport="";}
340
if (isset($_POST['uamport'])){	$uamport	= $_POST['uamport'];} else {$uamport="";}
341
if (isset($_POST['userurl'])){	$userurl	= $_POST['userurl'];} else {$userurl="";}
341
if (isset($_POST['userurl'])){	$userurl	= $_POST['userurl'];} else {$userurl="";}
342
if (isset($_POST['timeleft'])){	$timeleft	= $_POST['timeleft'];} else {$timeleft="";}
342
if (isset($_POST['timeleft'])){	$timeleft	= $_POST['timeleft'];} else {$timeleft="";}
343
if (isset($_POST['redirurl'])){	$redirurl	= $_POST['redirurl'];} else {$redirurl="";}
343
if (isset($_POST['redirurl'])){	$redirurl	= $_POST['redirurl'];} else {$redirurl="";}
344
 
344
 
345
# Read query parameters which we care about
345
# Read query parameters which we care about
346
if (isset($_GET['res']))		$res		= $_GET['res'];
346
if (isset($_GET['res']))		$res		= $_GET['res'];
347
if (isset($_GET['challenge']))	$challenge	= $_GET['challenge'];
347
if (isset($_GET['challenge']))	$challenge	= $_GET['challenge'];
348
if (isset($_GET['uamip']))		$uamip		= $_GET['uamip'];
348
if (isset($_GET['uamip']))		$uamip		= $_GET['uamip'];
349
if (isset($_GET['uamport']))	$uamport	= $_GET['uamport'];
349
if (isset($_GET['uamport']))	$uamport	= $_GET['uamport'];
350
if (isset($_GET['reply'])){		$reply		= $_GET['reply'];} else {$reply="";}
350
if (isset($_GET['reply'])){		$reply		= $_GET['reply'];} else {$reply="";}
351
if (isset($_GET['userurl']))	$userurl	= $_GET['userurl'];
351
if (isset($_GET['userurl']))	$userurl	= $_GET['userurl'];
352
if (isset($_GET['timeleft']))	$timeleft	= $_GET['timeleft'];
352
if (isset($_GET['timeleft']))	$timeleft	= $_GET['timeleft'];
353
if (isset($_GET['redirurl']))	$redirurl	= $_GET['redirurl'];
353
if (isset($_GET['redirurl']))	$redirurl	= $_GET['redirurl'];
354
 
354
 
355
# translation of radius replies
355
# translation of radius replies
356
if (isset($reply)){
356
if (isset($reply)){
357
	switch(trim ($reply)) {
357
	switch(trim ($reply)) {
358
  case 'Your maximum daily usage time has been reached' : $reply = $l_reply_1 ; break;
358
  case 'Your maximum daily usage time has been reached' : $reply = $l_reply_1 ; break;
359
  case 'Your maximum monthly usage time has been reached' : $reply = $l_reply_2 ; break;
359
  case 'Your maximum monthly usage time has been reached' : $reply = $l_reply_2 ; break;
360
  case 'You are calling outside your allowed timespan' : $reply = $l_reply_3 ; break;
360
  case 'You are calling outside your allowed timespan' : $reply = $l_reply_3 ; break;
361
  case 'Password Has Expired' : $reply =  $l_reply_4 ; break;
361
  case 'Password Has Expired' : $reply =  $l_reply_4 ; break;
362
  case 'You are already logged in - access denied' : $reply = $l_reply_5 ; break;
362
  case 'You are already logged in - access denied' : $reply = $l_reply_5 ; break;
363
  case 'Your maximum never usage time has been reached' : $reply = $l_reply_6 ; break;
363
  case 'Your maximum never usage time has been reached' : $reply = $l_reply_6 ; break;
364
  }}
364
  }}
365
 
365
 
366
# If attempt to login
366
# If attempt to login
367
if ("$button" == "$l_boutonO") {
367
if ("$button" == "$l_boutonO") {
368
  #correction password length in coova-chilli
368
  #correction password length in coova-chilli
369
  #thanks to http://www.stochasticgeometry.ie/2009/09/09/maximum-password-length-in-coova-chilli/
369
  #thanks to http://www.stochasticgeometry.ie/2009/09/09/maximum-password-length-in-coova-chilli/
370
  $hexchal = pack ("H*", $challenge);
370
  $hexchal = pack ("H*", $challenge);
371
  $newchal = pack ("H*", md5($hexchal . $uamsecret));
371
  $newchal = pack ("H*", md5($hexchal . $uamsecret));
372
 
372
 
373
  # If challenge isn't long enough, repeat it until it is
373
  # If challenge isn't long enough, repeat it until it is
374
  while (strlen($newchal) < strlen($password)){
374
  while (strlen($newchal) < strlen($password)){
375
                       $newchal .= $newchal;
375
                       $newchal .= $newchal;
376
  }
376
  }
377
 
377
 
378
  $response = md5("\0" . $password . $newchal);
378
  $response = md5("\0" . $password . $newchal);
379
  $newpwd = pack("a*", $password);
379
  $newpwd = pack("a*", $password);
380
  # Encode plain text password with challenge
380
  # Encode plain text password with challenge
381
  $pappassword = implode ("", unpack("H*", ($newpwd ^ $newchal)));
381
  $pappassword = implode ("", unpack("H*", ($newpwd ^ $newchal)));
382
  echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
382
  echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
383
<html>
383
<html>
384
<head>
384
<head>
385
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
385
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
386
  <title>$l_loggingin</title>
386
  <title>$l_loggingin</title>
387
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
387
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
388
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
388
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
389
  <meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/logon?username=$username&password=$pappassword&userurl=$userurl\">
389
  <meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/logon?username=$username&password=$pappassword&userurl=$userurl\">
390
  </head>
390
  </head>
391
<body bgColor = 'white'>
391
<body bgColor = 'white'>
392
<h1 style=\"text-align: center;\">$l_loggingin</h1>
392
<h1 style=\"text-align: center;\">$l_loggingin</h1>
393
  <center>
393
  <center>
394
    $l_wait
394
    $l_wait
395
  </center>
395
  </center>
396
</body>
396
</body>
397
</html>";
397
</html>";
398
exit(0);
398
exit(0);
399
}
399
}
400
 
400
 
401
switch($res) {
401
switch($res) {
402
  case 'success':     $result =  1; break; // If login successful
402
  case 'success':     $result =  1; break; // If login successful
403
  case 'failed':      $result =  2; break; // If login failed
403
  case 'failed':      $result =  2; break; // If login failed
404
  case 'logoff':      $result =  3; break; // If logout successful
404
  case 'logoff':      $result =  3; break; // If logout successful
405
  case 'already':     $result =  4; break; // If tried to login while already logged in
405
  case 'already':     $result =  4; break; // If tried to login while already logged in
406
  case 'notyet':      $result =  5; break; // If not logged in yet
406
  case 'notyet':      $result =  5; break; // If not logged in yet
407
  default: $result = 0; // Default: It was not a form request -> client go to login form
407
  default: $result = 0; // Default: It was not a form request -> client go to login form
408
}
408
}
409
 
409
 
410
//check if we need to warn user about the imputability logs.
410
//check if we need to warn user about the imputability logs.
411
if($result == 1)
411
if($result == 1)
412
{
412
{
413
        if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
413
        if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
414
        include_once("/etc/freeradius-web/config.php");
414
        include_once("/etc/freeradius-web/config.php");
415
        include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
415
        include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
416
	$user_url=$_GET['userurl'];
416
	$user_url=$_GET['userurl'];
417
        $user_uid=$_GET['uid'];
417
        $user_uid=$_GET['uid'];
418
        $sql = "SELECT attribute, value FROM radreply WHERE username='$user_uid'";
418
        $sql = "SELECT attribute, value FROM radreply WHERE username='$user_uid'";
419
        $link = @da_sql_pconnect($config); // on affiche pas les erreurs
419
        $link = @da_sql_pconnect($config); // on affiche pas les erreurs
420
        if ($link){
420
        if ($link){
421
                $res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
421
                $res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
422
                if ($res){
422
                if ($res){
423
                        while(($row = @da_sql_fetch_array($res,$config))){
423
                        while(($row = @da_sql_fetch_array($res,$config))){
424
                                if ($row['attribute'] == "Filter-Id") $filter_id = $row['value']; // on obtient le Filter-Id de l'utilisateur
424
                                if ($row['attribute'] == "Filter-Id") $filter_id = $row['value']; // on obtient le Filter-Id de l'utilisateur
425
                        }
425
                        }
426
                        if($filter_id[3] == '1')
426
                        if($filter_id[3] == '1')
427
                        {
427
                        {
428
                                #set the fourth bit of filter-id to '0'
428
                                #set the fourth bit of filter-id to '0'
429
                                $sql = "set @CurrentFilter=(SELECT value from radreply where username='$user_uid');set @CurrentFilterLeft=(SELECT LEFT(@CurrentFilter,3));set @CurrentFilterRight=(SELECT RIGHT(@CurrentFilter,4));UPDATE radreply SET value = CONCAT((@CurrentFilterLeft),'0', (@CurrentFilterRight)) WHERE username='$user_uid'";
429
                                $sql = "set @CurrentFilter=(SELECT value from radreply where username='$user_uid');set @CurrentFilterLeft=(SELECT LEFT(@CurrentFilter,3));set @CurrentFilterRight=(SELECT RIGHT(@CurrentFilter,4));UPDATE radreply SET value = CONCAT((@CurrentFilterLeft),'0', (@CurrentFilterRight)) WHERE username='$user_uid'";
430
                                $res = mysqli_multi_query($link,$sql);
430
                                $res = mysqli_multi_query($link,$sql);
431
                                header("Location: http://alcasar/index.php?warn=1&url=$user_url");   //we present to user information about imputability logs 
431
                                header("Location: http://alcasar/index.php?warn=1&url=$user_url");   //we present to user information about imputability logs 
432
                                exit;
432
                                exit;
433
                        }
433
                        }
434
                }
434
                }
435
        }
435
        }
436
        }
436
        }
437
        
437
        
438
}
438
}
439
 
439
 
440
 
440
 
441
# Otherwise it was not a form request
441
# Otherwise it was not a form request
442
# Send out an error message
442
# Send out an error message
443
if ($result == 0) {	//erreur
443
if ($result == 0) {	//erreur
444
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
444
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
445
<html>
445
<html>
446
<head>
446
<head>
447
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
447
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
448
  <title>$l_loggingin</title>
448
  <title>$l_loggingin</title>
449
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
449
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
450
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
450
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
451
  <meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/prelogin\">
451
  <meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/prelogin\">
452
  </head>
452
  </head>
453
<body bgColor = 'white'>
453
<body bgColor = 'white'>
454
<h1 style=\"text-align: center;\">$l_loggingin</h1>
454
<h1 style=\"text-align: center;\">$l_loggingin</h1>
455
  <center>
455
  <center>
456
    $l_wait
456
    $l_wait
457
  </center>
457
  </center>
458
</body>
458
</body>
459
</html>";
459
</html>";
460
    exit(0);
460
    exit(0);
461
}
461
}
462
# Generate the output
462
# Generate the output
463
echo "<!DOCTYPE html>
463
echo "<!DOCTYPE html>
464
<html>
464
<html>
465
<head>
465
<head>
466
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
466
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
467
  <title>$l_loggingin</title>
467
  <title>$l_loggingin</title>
468
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
468
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
469
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
469
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
470
  <script type=\"text/javascript\" language=\"JavaScript\">
470
  <script type=\"text/javascript\" language=\"JavaScript\">
471
	alcasar_popup = null;
471
	alcasar_popup = null;
472
	function popUp(URL) {
472
	function popUp(URL) {
473
		if (self.name != \"alcasar_popup\") {
473
		if (self.name != \"alcasar_popup\") {
474
			alcasar_popup = window.open(URL, 'alcasar_popup', 'width=500,height=460,directories=no,resizable=no,scrollbars=yes,location=no,toolbar=no,statusbar=no,menubar=no');
474
			alcasar_popup = window.open(URL, 'alcasar_popup', 'width=500,height=460,directories=no,resizable=no,scrollbars=yes,location=no,toolbar=no,statusbar=no,menubar=no');
475
		}
475
		}
476
	}
476
	}
477
	function doOnLoad(result, userurl, redirurl, adminurl, timeleft) {
477
	function doOnLoad(result, userurl, redirurl, adminurl, timeleft) {
478
		if ((result == 1)||(result == 4)) {	//success or already
478
		if ((result == 1)||(result == 4)) {	//success or already
479
			//window.location = userurl;
479
			//window.location = userurl;
480
			if (alcasar_popup != null) alcasar_popup.focus();
480
			if (alcasar_popup != null) alcasar_popup.focus();
481
			if (adminurl != ''){
481
			if (adminurl != ''){
482
				window.location = adminurl;
482
				window.location = adminurl;
483
			} else if (redirurl != '') {
483
			} else if (redirurl != '') {
484
				window.location = redirurl;
484
				window.location = redirurl;
485
				} else if (userurl != '') {
485
				} else if (userurl != '') {
486
					window.location = userurl;
486
					window.location = userurl;
487
				} else {
487
				} else {
488
				window.home();
488
				window.home();
489
			}
489
			}
490
		}
490
		}
491
		if ((result == 2) || (result == 3) || result == 5) { //failed or logoff or notyet
491
		if ((result == 2) || (result == 3) || result == 5) { //failed or logoff or notyet
492
			if (alcasar_popup != null) alcasar_popup.close();
492
			if (alcasar_popup != null) alcasar_popup.close();
493
			document.form1.UserName.focus();
493
			document.form1.UserName.focus();
494
		}
494
		}
495
	}
495
	}
496
</script>
496
</script>
497
<link rel=\"stylesheet\" href=\"/css/style_intercept.css\" type=\"text/css\">
497
<link rel=\"stylesheet\" href=\"/css/style_intercept.css\" type=\"text/css\">
498
</head>
498
</head>
499
<body onLoad=\"javascript:doOnLoad($result,'$userurl','$redirurl','$adminurl','$timeleft')\">
499
<body onLoad=\"javascript:doOnLoad($result,'$userurl','$redirurl','$adminurl','$timeleft')\">
500
  <center>";
500
  <center>";
501
if ($result == 2 || $result == 3 || $result == 5) { //failed or logoff or notyet
501
if ($result == 2 || $result == 3 || $result == 5) { //failed or logoff or notyet
502
  echo "
502
  echo "
503
	<div id=\"logon\">
503
	<div id=\"logon\">
504
	<h1>$organisme</h1>
504
	<h1>$organisme</h1>
505
	<h2>$l_loggedcont</h2>";
505
	<h2>$l_loggedcont</h2>";
506
	if ($result == 2) { //failed
506
	if ($result == 2) { //failed
507
		echo "	
507
		echo "	
508
		<h3>$l_loginfailed</h3>";
508
		<h3>$l_loginfailed</h3>";
509
		if ($reply) {
509
		if ($reply) {
510
		#traitement du reply ...
510
		#traitement du reply ...
511
		echo "<center> $reply <br /><br /></center>";
511
		echo "<center> $reply <br /><br /></center>";
512
		}
512
		}
513
	}
513
	}
514
	if ($userurl == "http://logout/") $userurl="http://www.google.com"; //avoid cyclic logout
514
	if ($userurl == "http://logout/") $userurl="http://www.google.com"; //avoid cyclic logout
515
	echo "
515
	echo "
516
	<img id=\"logo-alcasar\" src=\"/images/logo-alcasar.png\">
516
	<img id=\"logo-alcasar\" src=\"/images/logo-alcasar.png\">
517
	<form name=\"form1\" method=\"post\" action=\"$loginpath\">
517
	<form name=\"form1\" method=\"post\" action=\"$loginpath\">
518
	<input type=\"hidden\" name=\"challenge\" value=\"$challenge\">
518
	<input type=\"hidden\" name=\"challenge\" value=\"$challenge\">
519
	<input type=\"hidden\" name=\"uamip\" value=\"$uamip\">
519
	<input type=\"hidden\" name=\"uamip\" value=\"$uamip\">
520
	<input type=\"hidden\" name=\"uamport\" value=\"$uamport\">
520
	<input type=\"hidden\" name=\"uamport\" value=\"$uamport\">
521
	<input type=\"hidden\" name=\"userurl\" value=\"$userurl\">
521
	<input type=\"hidden\" name=\"userurl\" value=\"$userurl\">
522
	<table id=\"boite-logon\">
522
	<table id=\"boite-logon\">
523
		<tr>
523
		<tr>
524
			<td width=\"20%\" rowspan=\"4\"><img id=\"logo-organ\" src=\"/images/organisme.png\"></td>
524
			<td width=\"20%\" rowspan=\"4\"><img id=\"logo-organ\" src=\"/images/organisme.png\"></td>
525
			<td width=\"30%\" align=\"right\">$l_user</td>
525
			<td width=\"30%\" align=\"right\">$l_user</td>
526
			<td width=\"50%\" align=\"left\"><INPUT type=\"text\" maxLength=\"32\" name=\"UserName\" autocomplete=\"off\"></td>
526
			<td width=\"50%\" align=\"left\"><INPUT type=\"text\" maxLength=\"32\" name=\"UserName\" autocomplete=\"off\"></td>
527
		</tr>
527
		</tr>
528
		<tr>
528
		<tr>
529
			<td align=\"right\">$l_password</td>
529
			<td align=\"right\">$l_password</td>
530
			<td align=\"left\"><INPUT maxLength=\"32\" type=\"password\" name=\"Password\" autocomplete=\"off\"></td>
530
			<td align=\"left\"><INPUT maxLength=\"32\" type=\"password\" name=\"Password\" autocomplete=\"off\"></td>
531
		</tr>
531
		</tr>
532
		";
532
		";
533
 
533
 
534
	echo "	</tr>
534
	echo "	</tr>
535
			<td height=\"23\"  align=\"left\"><INPUT value=\"$l_boutonO\" type=\"submit\" name=\"button\" onclick=\"window.open('$statuspath', '_blank');\"></td>
535
			<td height=\"23\"  align=\"left\"><INPUT value=\"$l_boutonO\" type=\"submit\" name=\"button\" onclick=\"window.open('$statuspath', '_blank');\"></td>
536
		";
536
		";
537
 
537
 
538
 
538
 
539
	$service_SMS_status=false;
539
	$service_SMS_status=false;
540
	if($service_SMS_status){
540
	if($service_SMS_status){
541
		echo "	<td><a href=\"./autoregistrationinfo.php\">".$l_autoregistration."</a></td>";
541
		echo "	<td><a href=\"./autoregistrationinfo.php\">".$l_autoregistration."</a></td>";
542
	}
542
	}
543
 
543
 
544
	echo "	</tr>
544
	echo "	</tr>
545
	</table>
545
	</table>
546
 
546
 
547
	</form>
547
	</form>
548
	<table id=\"boite-info\" cellSpacing=\"0\" cellPadding=\"0\" width=\"80%\">
548
	<table id=\"boite-info\" cellSpacing=\"0\" cellPadding=\"0\" width=\"80%\">
549
		<tr>
549
		<tr>
550
			<td align=\"center\"><FONT color=\"red\"><B>$l_loggedin_stringl1</B></FONT></td>
550
			<td align=\"center\"><FONT color=\"red\"><B>$l_loggedin_stringl1</B></FONT></td>
551
		</tr>
551
		</tr>
552
		<tr>
552
		<tr>
553
			<td align=\"left\">
553
			<td align=\"left\">
554
				<ul>
554
				<ul>
555
					<LI>$l_loggedin_stringl2</LI>
555
					<LI>$l_loggedin_stringl2</LI>
556
					<LI>$l_loggedin_stringl4</LI>
556
					<LI>$l_loggedin_stringl4</LI>
557
					<LI>$l_loggedin_stringl3</LI>
557
					<LI>$l_loggedin_stringl3</LI>
558
					<LI>$l_loggedin_stringl5</LI>
558
					<LI>$l_loggedin_stringl5</LI>
559
					<LI>$l_loggedin_stringl6</LI>
559
					<LI>$l_loggedin_stringl6</LI>
560
				</ul>
560
				</ul>
561
			</td>
561
			</td>
562
		</tr>
562
		</tr>
563
	</table>";
563
	</table>";
564
 
564
 
565
// Read the "Domain allowed" file
565
// Read the "Domain allowed" file
566
$tab=file(DOMAIN_ALLOWED_LIST);
566
$tab=file(DOMAIN_ALLOWED_LIST);
567
if ($tab)  # the file isn't empty
567
if ($tab)  # the file isn't empty
568
	{
568
	{
569
	echo "<div id=\"authorized_domain\">$l_uam_domain";
569
	echo "<div id=\"authorized_domain\">$l_uam_domain";
570
	foreach ($tab as $line)
570
	foreach ($tab as $line)
571
		{
571
		{
572
		if (trim($line) != '') # the line isn't empty
572
		if (trim($line) != '') # the line isn't empty
573
			{
573
			{
574
			$domain_allowed=explode("#", $line);
574
			$domain_allowed=explode("#", $line);
575
			if (trim($domain_allowed[1]) != ''){
575
			if (trim($domain_allowed[1]) != ''){
576
				$domain=explode("\"", $domain_allowed[0]);
576
				$domain=explode("\"", $domain_allowed[0]);
577
				#remove every '.' from the beginning of domain
577
				#remove every '.' from the beginning of domain
578
                                $domain[1] = ltrim($domain[1], '.');
578
                                $domain[1] = ltrim($domain[1], '.');
579
				echo "<a href=\"http://".trim($domain[1])."\">".trim($domain_allowed[1])."</a> ";}
579
				echo "<a href=\"http://".trim($domain[1])."\">".trim($domain_allowed[1])."</a> ";}
580
			}	
580
			}	
581
		}
581
		}
582
	}
582
	}
583
echo "	
583
echo "	
584
</div>
584
</div>
585
</center>
585
</center>
586
</body>
586
</body>
587
</html>";
587
</html>";
588
}
588
}
589
exit(0);
589
exit(0);
590
?>
590
?>
591
 
591