Subversion Repositories ALCASAR

Rev

Rev 2240 | Rev 2370 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2240 Rev 2346
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: status.php 2240 2017-05-20 21:46:11Z tom.houdayer $
2
# $Id: status.php 2346 2017-07-21 23:09:06Z tom.houdayer $
3
#
3
#
4
# status.php for ALCASAR captive portal
4
# status.php for ALCASAR captive portal
5
# by steweb57 & Rexy
5
# by steweb57 & Rexy
6
# 
6
# 
7
/****************************************************************
7
/****************************************************************
Line 31... Line 31...
31
}
31
}
32
while (!feof($file_conf)) {
32
while (!feof($file_conf)) {
33
	$buffer = fgets($file_conf, 4096);
33
	$buffer = fgets($file_conf, 4096);
34
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
34
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
35
		$tmp = explode('=', $buffer);
35
		$tmp = explode('=', $buffer);
36
		$conf[$tmp[0]] = trim($tmp[1]);
36
		$conf[trim($tmp[0])] = trim($tmp[1]);
37
	}
37
	}
38
}
38
}
39
fclose($file_conf);
39
fclose($file_conf);
40
 
40
 
41
$organisme = $conf['ORGANISM'];
41
$organisme = $conf['ORGANISM'];
42
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
42
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
43
$cn = '';
43
$cn = '';
44
$connection_history = '';
44
$connection_history = '';
45
$nb_connection_history = 3;
45
$nb_connection_history = 3;
-
 
46
$homepage_url = (($conf['HTTPS_LOGIN'] === 'on') ? 'https' : 'http' ).'://'.$conf['HOSTNAME'].'.'.$conf['DOMAIN'].'/';
46
 
47
 
47
// Wait for chilli (update its tables)
48
// Wait for chilli (update its tables)
48
sleep(1); // TODO: wait after login only?
49
sleep(1); // TODO: wait after login only?
49
// Retrieve user info in tab $user[]
50
// Retrieve user info in tab $user[]
50
exec("sudo /usr/sbin/chilli_query list | grep 'pass' | grep -Ew '($remote_ip)'" , $tab);
51
exec("sudo /usr/sbin/chilli_query list | grep 'pass' | grep -Ew '($remote_ip)'" , $tab);
Line 91... Line 92...
91
	$l_conn_history			= "Your last $nb_connection_history connections";	// to translate
92
	$l_conn_history			= "Your last $nb_connection_history connections";	// to translate
92
	$l_connected 			= "logged"; // to translate
93
	$l_connected 			= "logged"; // to translate
93
	$l_a_connection			= "You have"; // to translate
94
	$l_a_connection			= "You have"; // to translate
94
	$l_a_connection_time		= "active connections on the network"; // to translate
95
	$l_a_connection_time		= "active connections on the network"; // to translate
95
	$l_close_warning		= "Advertencia: se desconectará si cierra esta ventana";
96
	$l_close_warning		= "Advertencia: se desconectará si cierra esta ventana";
-
 
97
	$l_back_homepage		= "Volver a la página de inicio";
96
} else if ($Language === 'zh') {	// Chinese
98
} else if ($Language === 'zh') {	// Chinese
97
	$l_login1			= "验证通过";
99
	$l_login1			= "验证通过";
98
	$l_logout			= "关闭连接";
100
	$l_logout			= "关闭连接";
99
	$l_logout_question		= "您确定需要断开连接吗?";
101
	$l_logout_question		= "您确定需要断开连接吗?";
100
	$l_loggedout			= "您已登出";
102
	$l_loggedout			= "您已登出";
Line 115... Line 117...
115
	$l_conn_history			= "您最近的{$nb_connection_history}次连接";
117
	$l_conn_history			= "您最近的{$nb_connection_history}次连接";
116
	$l_connected 			= "已登录";  
118
	$l_connected 			= "已登录";  
117
	$l_a_connection			= "您已经有";
119
	$l_a_connection			= "您已经有";
118
	$l_a_connection_time		= "在线时间";
120
	$l_a_connection_time		= "在线时间";
119
	$l_close_warning		= "警告: 您将会断开连接如果您在关闭此窗口";
121
	$l_close_warning		= "警告: 您将会断开连接如果您在关闭此窗口";
-
 
122
	$l_back_homepage		= "回到主页";
120
} else if ($Language === 'ar') {	// Arabic
123
} else if ($Language === 'ar') {	// Arabic
121
	$l_login1			= "نجاح المصادقة";
124
	$l_login1			= "نجاح المصادقة";
122
	$l_logout			= "إغلاق الدورة";
125
	$l_logout			= "إغلاق الدورة";
123
	$l_logout_question		= "هل تريد فعلاً قطع الاتصال؟";
126
	$l_logout_question		= "هل تريد فعلاً قطع الاتصال؟";
124
	$l_loggedout			= "دورتكَ مُغلَقة";
127
	$l_loggedout			= "دورتكَ مُغلَقة";
Line 140... Line 143...
140
	$l_conn_history			= "($nb_connection_history) سِجِل اتصالاتك الاخيرة";
143
	$l_conn_history			= "($nb_connection_history) سِجِل اتصالاتك الاخيرة";
141
	$l_connected 			= "دورة ناشطة";  
144
	$l_connected 			= "دورة ناشطة";  
142
	$l_a_connection			= "لديك";
145
	$l_a_connection			= "لديك";
143
	$l_a_connection_time		= "اتصالات ناشطة على الشبكة";
146
	$l_a_connection_time		= "اتصالات ناشطة على الشبكة";
144
	$l_close_warning		= "تحذير: سيتم قطع الاتصال إذا قمت بإغلاق هذه النافذة";
147
	$l_close_warning		= "تحذير: سيتم قطع الاتصال إذا قمت بإغلاق هذه النافذة";
-
 
148
	$l_back_homepage		= "الرجوع إلى الصفحة الرئيسية";
145
} else if ($Language === 'pt') {	// Portuguese
149
} else if ($Language === 'pt') {	// Portuguese
146
	$l_login1			= "Autenticação bem sucedida.";
150
	$l_login1			= "Autenticação bem sucedida.";
147
	$l_logout			= "Fechando a conexão";
151
	$l_logout			= "Fechando a conexão";
148
	$l_logout_question		= "Tem certeza de que deseja desconectar agora?";
152
	$l_logout_question		= "Tem certeza de que deseja desconectar agora?";
149
	$l_loggedout			= "Sua conexão será fechada";
153
	$l_loggedout			= "Sua conexão será fechada";
Line 164... Line 168...
164
	$l_conn_history			= "Suas últimos conexões : $nb_connection_history";
168
	$l_conn_history			= "Suas últimos conexões : $nb_connection_history";
165
	$l_connected 			= "Conectado"; 
169
	$l_connected 			= "Conectado"; 
166
	$l_a_connection			= "Conexão ativa já detectada para essa LAN";
170
	$l_a_connection			= "Conexão ativa já detectada para essa LAN";
167
	$l_a_connection_time		= "Tempo (s)";
171
	$l_a_connection_time		= "Tempo (s)";
168
	$l_close_warning		= "Aviso: você será desconectado se fechar esta janela";
172
	$l_close_warning		= "Aviso: você será desconectado se fechar esta janela";
-
 
173
	$l_back_homepage		= "Voltar à página inicial";
169
} else if ($Language === 'de') {	// German
174
} else if ($Language === 'de') {	// German
170
	$l_login1			= "Erfolgreiche Authentifizierung";
175
	$l_login1			= "Erfolgreiche Authentifizierung";
171
	$l_logout			= "Beenden der Verbindung";
176
	$l_logout			= "Beenden der Verbindung";
172
	$l_logout_question		= "Möchten Sie die Verbindung jetzt wirklich trennen?";
177
	$l_logout_question		= "Möchten Sie die Verbindung jetzt wirklich trennen?";
173
	$l_loggedout			= "Ihre Sitzung ist geschlossen";
178
	$l_loggedout			= "Ihre Sitzung ist geschlossen";
Line 188... Line 193...
188
	$l_conn_history			= "Your last $nb_connection_history connections";	// to translate
193
	$l_conn_history			= "Your last $nb_connection_history connections";	// to translate
189
	$l_connected 			= "logged"; // to translate 
194
	$l_connected 			= "logged"; // to translate 
190
	$l_a_connection			= "You have"; // to translate
195
	$l_a_connection			= "You have"; // to translate
191
	$l_a_connection_time		= "active connections on the network"; // to translate
196
	$l_a_connection_time		= "active connections on the network"; // to translate
192
	$l_close_warning		= "Warnung: Sie werden getrennt, wenn Sie dieses Fenster schließen";
197
	$l_close_warning		= "Warnung: Sie werden getrennt, wenn Sie dieses Fenster schließen";
-
 
198
	$l_back_homepage		= "Zurück zur Startseite";
193
} else if ($Language === 'nl') {	// Dutch
199
} else if ($Language === 'nl') {	// Dutch
194
	$l_login1			= "Succesvolle authenticatie";
200
	$l_login1			= "Succesvolle authenticatie";
195
	$l_logout			= "Slotkoers verbinding";
201
	$l_logout			= "Slotkoers verbinding";
196
	$l_logout_question		= "Bent u zeker dat u wilt nu los te koppelen?";
202
	$l_logout_question		= "Bent u zeker dat u wilt nu los te koppelen?";
197
	$l_loggedout			= "Uw sessie is gesloten";
203
	$l_loggedout			= "Uw sessie is gesloten";
Line 212... Line 218...
212
	$l_conn_history			= "Your last $nb_connection_history connections";	// to translate
218
	$l_conn_history			= "Your last $nb_connection_history connections";	// to translate
213
	$l_connected 			= "logged"; // to translate 
219
	$l_connected 			= "logged"; // to translate 
214
	$l_a_connection			= "You have"; // to translate
220
	$l_a_connection			= "You have"; // to translate
215
	$l_a_connection_time		= "active connections on the network"; // to translate
221
	$l_a_connection_time		= "active connections on the network"; // to translate
216
	$l_close_warning		= "Waarschuwing: u zal worden afgebroken als u dit venster sluiten";
222
	$l_close_warning		= "Waarschuwing: u zal worden afgebroken als u dit venster sluiten";
-
 
223
	$l_back_homepage		= "Terug naar de homepage";
217
} else if ($Language === 'fr') {	// French
224
} else if ($Language === 'fr') {	// French
218
	$l_login1			= "Authentification réussie";
225
	$l_login1			= "Authentification réussie";
219
	$l_logout			= "Fermeture de la session";
226
	$l_logout			= "Fermeture de la session";
220
	$l_logout_question		= "Êtes vous sûr de vouloir vous déconnecter?";
227
	$l_logout_question		= "Êtes vous sûr de vouloir vous déconnecter?";
221
	$l_loggedout			= "Votre session est fermée";
228
	$l_loggedout			= "Votre session est fermée";
Line 236... Line 243...
236
	$l_conn_history			= "Vos $nb_connection_history dernières connexions";
243
	$l_conn_history			= "Vos $nb_connection_history dernières connexions";
237
	$l_connected 			= "session active";  
244
	$l_connected 			= "session active";  
238
	$l_a_connection			= "Vous avez";
245
	$l_a_connection			= "Vous avez";
239
	$l_a_connection_time		= "connexions actives sur le réseau";
246
	$l_a_connection_time		= "connexions actives sur le réseau";
240
	$l_close_warning		= "Attention : vous serez déconnecté si vous fermez cette fenêtre";
247
	$l_close_warning		= "Attention : vous serez déconnecté si vous fermez cette fenêtre";
-
 
248
	$l_back_homepage		= "Revenir à la page d'accueil";
241
} else {				// English
249
} else {				// English
242
	$l_login1			= "Successful authentication.";
250
	$l_login1			= "Successful authentication.";
243
	$l_logout			= "Closing connection";
251
	$l_logout			= "Closing connection";
244
	$l_logout_question		= "Are you sure you want to disconnect now?";
252
	$l_logout_question		= "Are you sure you want to disconnect now?";
245
	$l_loggedout			= "Your session is closed";
253
	$l_loggedout			= "Your session is closed";
Line 260... Line 268...
260
	$l_conn_history			= "Your last $nb_connection_history connections";
268
	$l_conn_history			= "Your last $nb_connection_history connections";
261
	$l_connected 			= "logged"; 
269
	$l_connected 			= "logged"; 
262
	$l_a_connection			= "You have";
270
	$l_a_connection			= "You have";
263
	$l_a_connection_time		= "active connections on the network";
271
	$l_a_connection_time		= "active connections on the network";
264
	$l_close_warning		= "Warning: you will be disconnected if you close this window";
272
	$l_close_warning		= "Warning: you will be disconnected if you close this window";
-
 
273
	$l_back_homepage		= "Back to homepage";
265
}
274
}
266
 
275
 
267
if (isset($user[5])) {
276
if (isset($user[5])) {
268
	if ((is_file('acc/manager/lib/sql/drivers/mysql/functions.php')) && (is_file('/etc/freeradius-web/config.php'))) {
277
	if ((is_file('acc/manager/lib/sql/drivers/mysql/functions.php')) && (is_file('/etc/freeradius-web/config.php'))) {
269
		require_once('/etc/freeradius-web/config.php');
278
		require_once('/etc/freeradius-web/config.php');
Line 353... Line 362...
353
			<div id="chilliPage">
362
			<div id="chilliPage">
354
				<div id="loggedOutPage" class="c1">
363
				<div id="loggedOutPage" class="c1">
355
					<table id="disconnectTable">
364
					<table id="disconnectTable">
356
						<tr>
365
						<tr>
357
							<td><img height="150" src="images/logo-alcasar.png" alt="logo"></td>
366
							<td><img height="150" src="images/logo-alcasar.png" alt="logo"></td>
-
 
367
							<td>
358
							<td><p class="text_auth"><?= $l_loggedout ?></p></td>
368
								<p class="text_auth"><?= $l_loggedout ?></p>
-
 
369
								<p class="text_homelink"><a href="<?= $homepage_url ?>"><?= $l_back_homepage ?></a></p>
-
 
370
							</td>
359
						</tr>
371
						</tr>
360
					</table>
372
					</table>
361
				</div>
373
				</div>
362
				<div id="statusPage" class="c1">
374
				<div id="statusPage" class="c1">
363
					<table border="0" id="statusTable">
375
					<table border="0" id="statusTable">