Subversion Repositories ALCASAR

Rev

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

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