Subversion Repositories ALCASAR

Rev

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

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