Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
# $Id: status.php 2172 2017-04-21 22:15:39Z tom.houdayer $
|
2 |
# $Id: status.php 2240 2017-05-20 21:46:11Z 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 |
/****************************************************************
|
8 |
* GLOBAL FILE PATHS *
|
8 |
* GLOBAL FILE PATHS *
|
9 |
*****************************************************************/
|
9 |
*****************************************************************/
|
10 |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
|
10 |
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
|
11 |
|
11 |
|
12 |
/****************************************************************
|
12 |
/****************************************************************
|
13 |
* FILE TEST *
|
13 |
* FILE reading test *
|
14 |
*****************************************************************/
|
14 |
*****************************************************************/
|
- |
|
15 |
$conf_files = array(CONF_FILE);
|
15 |
//Test de présence et des droits en lecture des fichiers de configuration.
|
16 |
foreach ($conf_files as $file) {
|
16 |
if (!file_exists(CONF_FILE)){
|
17 |
if (!file_exists($file)) {
|
17 |
exit("Fichier de configuration ".CONF_FILE." non présent");
|
18 |
exit("Fichier $file non présent");
|
18 |
}
|
19 |
}
|
19 |
if (!is_readable(CONF_FILE)){
|
20 |
if (!is_readable($file)) {
|
20 |
exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE);
|
21 |
exit("Vous n'avez pas les droits de lecture sur le fichier $file");
|
- |
|
22 |
}
|
21 |
}
|
23 |
}
|
22 |
|
24 |
|
23 |
/****************************************************************
|
25 |
/****************************************************************
|
24 |
* Read CONF_FILE *
|
26 |
* Read CONF_FILE *
|
25 |
*****************************************************************/
|
27 |
*****************************************************************/
|
26 |
$ouvre=fopen(CONF_FILE,"r");
|
28 |
$file_conf = fopen(CONF_FILE, 'r');
|
27 |
if ($ouvre){
|
29 |
if (!$file_conf) {
|
28 |
while (!feof ($ouvre))
|
30 |
exit('Error opening the file '.CONF_FILE);
|
29 |
{
|
31 |
}
|
- |
|
32 |
while (!feof($file_conf)) {
|
30 |
$tampon = fgets($ouvre, 4096);
|
33 |
$buffer = fgets($file_conf, 4096);
|
31 |
if (strpos($tampon,"=")!==false){
|
34 |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
|
32 |
$tmp = explode("=",$tampon);
|
35 |
$tmp = explode('=', $buffer);
|
33 |
$conf[$tmp[0]] = $tmp[1];
|
36 |
$conf[$tmp[0]] = trim($tmp[1]);
|
34 |
}
|
- |
|
35 |
}
|
37 |
}
|
36 |
}else{
|
- |
|
37 |
exit("Erreur d'ouverture du fichier ".CONF_FILE);
|
- |
|
38 |
}
|
38 |
}
|
39 |
fclose($ouvre);
|
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 |
$connection_history = "";
|
44 |
$connection_history = '';
|
44 |
$nb_connection_history = 3;
|
45 |
$nb_connection_history = 3;
|
45 |
|
46 |
|
46 |
// Wait for chilli (uptade its tables)
|
47 |
// Wait for chilli (update its tables)
|
47 |
sleep (1);
|
48 |
sleep(1); // TODO: wait after login only?
|
48 |
// Retrieve user info in tab $user[]
|
49 |
// Retrieve user info in tab $user[]
|
49 |
exec ("sudo /usr/sbin/chilli_query list | grep 'pass' | grep -Ew '($remote_ip)'" , $tab);
|
50 |
exec("sudo /usr/sbin/chilli_query list | grep 'pass' | grep -Ew '($remote_ip)'" , $tab);
|
50 |
if(isset($tab[0]))
|
51 |
if (isset($tab[0])) {
|
51 |
$user = explode (" ", $tab[0]);
|
52 |
$user = explode(' ', $tab[0]);
|
- |
|
53 |
}
|
52 |
|
54 |
|
53 |
#### Time conversion
|
55 |
// Time conversion
|
54 |
function secondsToDuration($seconds = null){
|
56 |
function secondsToDuration($seconds = null) {
|
55 |
if ($seconds == null) return "";
|
57 |
if ($seconds === null) return '';
|
56 |
$temp = $seconds % 3600;
|
58 |
$temp = $seconds % 3600;
|
57 |
$time[0] = ( $seconds - $temp ) / 3600 ; // hours
|
59 |
$time[2] = $temp % 60 ; // seconds
|
58 |
$time[2] = $temp % 60 ; // seconds
|
60 |
$time[1] = ($temp - $time[2]) / 60; // minutes
|
59 |
$time[1] = ( $temp - $time[2] ) / 60; // minutes
|
61 |
$time[0] = ($seconds - $temp) / 3600 ; // hours
|
60 |
return $time[0]." h ".$time[1]." m ".$time[2]." s";
|
62 |
return $time[0].' h '.$time[1].' m '.$time[2].' s';
|
61 |
}
|
63 |
}
|
62 |
|
64 |
|
63 |
# Choice of language
|
65 |
# Choice of language
|
64 |
//reste quelques traductions à faire
|
66 |
// TODO: reste quelques traductions à faire
|
65 |
$Language = 'en';
|
67 |
$Language = 'en';
|
66 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
68 |
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
67 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
69 |
$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
68 |
$Language = strtolower(substr(chop($Langue[0]),0,2));
|
70 |
$Language = strtolower(substr(chop($Langue[0]), 0, 2));
|
69 |
}
|
71 |
}
|
70 |
if($Language == 'es'){
|
72 |
if ($Language === 'es') { // Spanish
|
71 |
$l_login1 = "El éxito de la autenticación";
|
73 |
$l_login1 = "El éxito de la autenticación";
|
72 |
$l_logout = "Conexión de cierre";
|
74 |
$l_logout = "Conexión de cierre";
|
73 |
$l_logout_question = "¿Seguro que desea desconectar?";
|
75 |
$l_logout_question = "¿Seguro que desea desconectar?";
|
74 |
$l_loggedout = "Su sesión se cierra";
|
76 |
$l_loggedout = "Su sesión se cierra";
|
75 |
$l_wait = "Por favor, espere un momento ...";
|
77 |
$l_wait = "Por favor, espere un momento ...";
|
Line 89... |
Line 91... |
89 |
$l_conn_history = "Your last $nb_connection_history connections"; // to translate
|
91 |
$l_conn_history = "Your last $nb_connection_history connections"; // to translate
|
90 |
$l_connected = "logged"; // to translate
|
92 |
$l_connected = "logged"; // to translate
|
91 |
$l_a_connection = "You have"; // to translate
|
93 |
$l_a_connection = "You have"; // to translate
|
92 |
$l_a_connection_time = "active connections on the network"; // to translate
|
94 |
$l_a_connection_time = "active connections on the network"; // to translate
|
93 |
$l_close_warning = "Advertencia: se desconectará si cierra esta ventana";
|
95 |
$l_close_warning = "Advertencia: se desconectará si cierra esta ventana";
|
94 |
}
|
- |
|
95 |
else if ($Language == 'zh'){
|
96 |
} else if ($Language === 'zh') { // Chinese
|
96 |
$l_login1 = "验证通过";
|
97 |
$l_login1 = "验证通过";
|
97 |
$l_logout = "关闭连接";
|
98 |
$l_logout = "关闭连接";
|
98 |
$l_logout_question = "您确定需要断开连接吗?";
|
99 |
$l_logout_question = "您确定需要断开连接吗?";
|
99 |
$l_loggedout = "您已登出";
|
100 |
$l_loggedout = "您已登出";
|
100 |
$l_wait = "请等待 ...";
|
101 |
$l_wait = "请等待 ...";
|
Line 114... |
Line 115... |
114 |
$l_conn_history = "您最近的{$nb_connection_history}次连接";
|
115 |
$l_conn_history = "您最近的{$nb_connection_history}次连接";
|
115 |
$l_connected = "已登录";
|
116 |
$l_connected = "已登录";
|
116 |
$l_a_connection = "您已经有";
|
117 |
$l_a_connection = "您已经有";
|
117 |
$l_a_connection_time = "在线时间";
|
118 |
$l_a_connection_time = "在线时间";
|
118 |
$l_close_warning = "警告: 您将会断开连接如果您在关闭此窗口";
|
119 |
$l_close_warning = "警告: 您将会断开连接如果您在关闭此窗口";
|
119 |
}
|
- |
|
120 |
else if ($Language == 'ar'){
|
120 |
} else if ($Language === 'ar') { // Arabic
|
121 |
$l_login1 = "نجاح المصادقة";
|
121 |
$l_login1 = "نجاح المصادقة";
|
122 |
$l_logout = "إغلاق الدورة";
|
122 |
$l_logout = "إغلاق الدورة";
|
123 |
$l_logout_question = "هل تريد فعلاً قطع الاتصال؟";
|
123 |
$l_logout_question = "هل تريد فعلاً قطع الاتصال؟";
|
124 |
$l_loggedout = "دورتكَ مُغلَقة";
|
124 |
$l_loggedout = "دورتكَ مُغلَقة";
|
125 |
$l_wait = "...إنتظر بعض اللحظات";
|
125 |
$l_wait = "...إنتظر بعض اللحظات";
|
Line 140... |
Line 140... |
140 |
$l_conn_history = "($nb_connection_history) سِجِل اتصالاتك الاخيرة";
|
140 |
$l_conn_history = "($nb_connection_history) سِجِل اتصالاتك الاخيرة";
|
141 |
$l_connected = "دورة ناشطة";
|
141 |
$l_connected = "دورة ناشطة";
|
142 |
$l_a_connection = "لديك";
|
142 |
$l_a_connection = "لديك";
|
143 |
$l_a_connection_time = "اتصالات ناشطة على الشبكة";
|
143 |
$l_a_connection_time = "اتصالات ناشطة على الشبكة";
|
144 |
$l_close_warning = "تحذير: سيتم قطع الاتصال إذا قمت بإغلاق هذه النافذة";
|
144 |
$l_close_warning = "تحذير: سيتم قطع الاتصال إذا قمت بإغلاق هذه النافذة";
|
145 |
}
|
- |
|
146 |
else if ($Language == 'pt'){
|
145 |
} else if ($Language === 'pt') { // Portuguese
|
147 |
$l_login1 = "Autenticação bem sucedida.";
|
146 |
$l_login1 = "Autenticação bem sucedida.";
|
148 |
$l_logout = "Fechando a conexão";
|
147 |
$l_logout = "Fechando a conexão";
|
149 |
$l_logout_question = "Tem certeza de que deseja desconectar agora?";
|
148 |
$l_logout_question = "Tem certeza de que deseja desconectar agora?";
|
150 |
$l_loggedout = "Sua conexão será fechada";
|
149 |
$l_loggedout = "Sua conexão será fechada";
|
151 |
$l_wait = "Por favor, aguarde um momento ...";
|
150 |
$l_wait = "Por favor, aguarde um momento ...";
|
Line 165... |
Line 164... |
165 |
$l_conn_history = "Suas últimos conexões : $nb_connection_history";
|
164 |
$l_conn_history = "Suas últimos conexões : $nb_connection_history";
|
166 |
$l_connected = "Conectado";
|
165 |
$l_connected = "Conectado";
|
167 |
$l_a_connection = "Conexão ativa já detectada para essa LAN";
|
166 |
$l_a_connection = "Conexão ativa já detectada para essa LAN";
|
168 |
$l_a_connection_time = "Tempo (s)";
|
167 |
$l_a_connection_time = "Tempo (s)";
|
169 |
$l_close_warning = "Aviso: você será desconectado se fechar esta janela";
|
168 |
$l_close_warning = "Aviso: você será desconectado se fechar esta janela";
|
170 |
}
|
- |
|
171 |
else if ($Language == 'de'){
|
169 |
} else if ($Language === 'de') { // German
|
172 |
$l_login1 = "Erfolgreiche Authentifizierung";
|
170 |
$l_login1 = "Erfolgreiche Authentifizierung";
|
173 |
$l_logout = "Beenden der Verbindung";
|
171 |
$l_logout = "Beenden der Verbindung";
|
174 |
$l_logout_question = "Möchten Sie die Verbindung jetzt wirklich trennen?";
|
172 |
$l_logout_question = "Möchten Sie die Verbindung jetzt wirklich trennen?";
|
175 |
$l_loggedout = "Ihre Sitzung ist geschlossen";
|
173 |
$l_loggedout = "Ihre Sitzung ist geschlossen";
|
176 |
$l_wait = "Bitte warten Sie einen Moment ...";
|
174 |
$l_wait = "Bitte warten Sie einen Moment ...";
|
Line 190... |
Line 188... |
190 |
$l_conn_history = "Your last $nb_connection_history connections"; // to translate
|
188 |
$l_conn_history = "Your last $nb_connection_history connections"; // to translate
|
191 |
$l_connected = "logged"; // to translate
|
189 |
$l_connected = "logged"; // to translate
|
192 |
$l_a_connection = "You have"; // to translate
|
190 |
$l_a_connection = "You have"; // to translate
|
193 |
$l_a_connection_time = "active connections on the network"; // to translate
|
191 |
$l_a_connection_time = "active connections on the network"; // to translate
|
194 |
$l_close_warning = "Warnung: Sie werden getrennt, wenn Sie dieses Fenster schließen";
|
192 |
$l_close_warning = "Warnung: Sie werden getrennt, wenn Sie dieses Fenster schließen";
|
195 |
}
|
- |
|
196 |
else if ($Language == 'nl'){
|
193 |
} else if ($Language === 'nl') { // Dutch
|
197 |
$l_login1 = "Succesvolle authenticatie";
|
194 |
$l_login1 = "Succesvolle authenticatie";
|
198 |
$l_logout = "Slotkoers verbinding";
|
195 |
$l_logout = "Slotkoers verbinding";
|
199 |
$l_logout_question = "Bent u zeker dat u wilt nu los te koppelen?";
|
196 |
$l_logout_question = "Bent u zeker dat u wilt nu los te koppelen?";
|
200 |
$l_loggedout = "Uw sessie is gesloten";
|
197 |
$l_loggedout = "Uw sessie is gesloten";
|
201 |
$l_wait = "Wacht een moment ...";
|
198 |
$l_wait = "Wacht een moment ...";
|
Line 215... |
Line 212... |
215 |
$l_conn_history = "Your last $nb_connection_history connections"; // to translate
|
212 |
$l_conn_history = "Your last $nb_connection_history connections"; // to translate
|
216 |
$l_connected = "logged"; // to translate
|
213 |
$l_connected = "logged"; // to translate
|
217 |
$l_a_connection = "You have"; // to translate
|
214 |
$l_a_connection = "You have"; // to translate
|
218 |
$l_a_connection_time = "active connections on the network"; // to translate
|
215 |
$l_a_connection_time = "active connections on the network"; // to translate
|
219 |
$l_close_warning = "Waarschuwing: u zal worden afgebroken als u dit venster sluiten";
|
216 |
$l_close_warning = "Waarschuwing: u zal worden afgebroken als u dit venster sluiten";
|
220 |
}
|
- |
|
221 |
else if ($Language == 'fr'){
|
217 |
} else if ($Language === 'fr') { // French
|
222 |
$l_login1 = "Authentification réussie";
|
218 |
$l_login1 = "Authentification réussie";
|
223 |
$l_logout = "Fermeture de la session";
|
219 |
$l_logout = "Fermeture de la session";
|
224 |
$l_logout_question = "Êtes vous sûr de vouloir vous déconnecter?";
|
220 |
$l_logout_question = "Êtes vous sûr de vouloir vous déconnecter?";
|
225 |
$l_loggedout = "Votre session est fermée";
|
221 |
$l_loggedout = "Votre session est fermée";
|
226 |
$l_wait = "Patientez un instant ....";
|
222 |
$l_wait = "Patientez un instant ....";
|
Line 240... |
Line 236... |
240 |
$l_conn_history = "Vos $nb_connection_history dernières connexions";
|
236 |
$l_conn_history = "Vos $nb_connection_history dernières connexions";
|
241 |
$l_connected = "session active";
|
237 |
$l_connected = "session active";
|
242 |
$l_a_connection = "Vous avez";
|
238 |
$l_a_connection = "Vous avez";
|
243 |
$l_a_connection_time = "connexions actives sur le réseau";
|
239 |
$l_a_connection_time = "connexions actives sur le réseau";
|
244 |
$l_close_warning = "Attention : vous serez déconnecté si vous fermez cette fenêtre";
|
240 |
$l_close_warning = "Attention : vous serez déconnecté si vous fermez cette fenêtre";
|
245 |
}
|
- |
|
246 |
else {
|
241 |
} else { // English
|
247 |
$l_login1 = "Successful authentication.";
|
242 |
$l_login1 = "Successful authentication.";
|
248 |
$l_logout = "Closing connection";
|
243 |
$l_logout = "Closing connection";
|
249 |
$l_logout_question = "Are you sure you want to disconnect now?";
|
244 |
$l_logout_question = "Are you sure you want to disconnect now?";
|
250 |
$l_loggedout = "Your session is closed";
|
245 |
$l_loggedout = "Your session is closed";
|
251 |
$l_wait = "Please wait a moment ...";
|
246 |
$l_wait = "Please wait a moment ...";
|
Line 267... |
Line 262... |
267 |
$l_a_connection = "You have";
|
262 |
$l_a_connection = "You have";
|
268 |
$l_a_connection_time = "active connections on the network";
|
263 |
$l_a_connection_time = "active connections on the network";
|
269 |
$l_close_warning = "Warning: you will be disconnected if you close this window";
|
264 |
$l_close_warning = "Warning: you will be disconnected if you close this window";
|
270 |
}
|
265 |
}
|
271 |
|
266 |
|
272 |
if (isset($user[5])){
|
267 |
if (isset($user[5])) {
|
273 |
// Retrieve the last connections
|
- |
|
274 |
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
|
268 |
if ((is_file('acc/manager/lib/sql/drivers/mysql/functions.php')) && (is_file('/etc/freeradius-web/config.php'))) {
|
275 |
include_once("/etc/freeradius-web/config.php");
|
269 |
require_once('/etc/freeradius-web/config.php');
|
276 |
include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
|
270 |
require_once('acc/manager/lib/sql/drivers/mysql/functions.php');
|
277 |
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
|
- |
|
278 |
$link = @da_sql_pconnect($config);
|
271 |
$link = @da_sql_pconnect($config);
|
279 |
if ($link){
|
272 |
if ($link) {
|
- |
|
273 |
// Retrieve the last connections
|
- |
|
274 |
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0, $nb_connection_history";
|
280 |
$res = @da_sql_query($link,$config,$sql);
|
275 |
$res = @da_sql_query($link, $config, $sql);
|
281 |
if ($res){
|
276 |
if ($res) {
|
- |
|
277 |
$a_connection = '';
|
- |
|
278 |
$a_connected = 0;
|
282 |
$a_connection = ""; $a_connected=0; $connection_history.= "<ul>";
|
279 |
$connection_history = '<ul>';
|
283 |
while(($row = @da_sql_fetch_array($res,$config))){
|
280 |
while (($row = @da_sql_fetch_array($res,$config))) {
|
284 |
$connected = "";
|
- |
|
285 |
$start_conn = date_create($row['acctstarttime']);
|
281 |
$start_conn = date_create($row['acctstarttime']);
|
286 |
$connection_history.="<li>".date_format($start_conn, 'd M Y - H:i:s')." - (";
|
- |
|
287 |
if ($row['acctstoptime'] == "") {
|
282 |
if (empty($row['acctstoptime'])) {
|
288 |
$connected = $l_connected;
|
283 |
$connected = $l_connected;
|
289 |
$a_connected = $a_connected +1;
|
284 |
$a_connected++;
|
290 |
}else{
|
285 |
} else {
|
291 |
$connected = secondsToDuration($row['acctsessiontime']);
|
286 |
$connected = secondsToDuration($row['acctsessiontime']);
|
292 |
}
|
287 |
}
|
- |
|
288 |
$connection_history .= '<li>'.date_format($start_conn, 'd M Y - H:i:s')." - ($connected)</li>";
|
- |
|
289 |
}
|
293 |
$connection_history.= "$connected)</li>";
|
290 |
$connection_history .= '</ul>';
|
- |
|
291 |
if ($a_connected > 1) {
|
- |
|
292 |
$a_connection = $l_a_connection.' '.$a_connected.' '.$l_a_connection_time;
|
294 |
}
|
293 |
}
|
295 |
$connection_history.="</ul>";
|
- |
|
296 |
if ($a_connected > 1){
|
- |
|
297 |
$a_connection = $l_a_connection." ".$a_connected." ".$l_a_connection_time; }
|
- |
|
298 |
}
|
294 |
}
|
299 |
}
|
295 |
|
300 |
// Retrieve first name & last name
|
296 |
// Retrieve first name & last name
|
301 |
$sql = "SELECT Name FROM userinfo WHERE UserName='$user[5]'";
|
297 |
$sql = "SELECT Name FROM userinfo WHERE UserName='$user[5]'";
|
302 |
$link = @da_sql_pconnect($config);
|
- |
|
303 |
if ($link){
|
- |
|
304 |
$res = @da_sql_query($link,$config,$sql);
|
298 |
$res = @da_sql_query($link, $config, $sql);
|
305 |
if ($res){
|
299 |
if ($res) {
|
306 |
$row = @da_sql_fetch_array($res,$config);
|
300 |
$row = @da_sql_fetch_array($res,$config);
|
307 |
$cn = ($row['name'] != '') ? $row['name'] : $user[5];
|
301 |
$cn = (!empty($row['name'])) ? $row['name'] : $user[5];
|
308 |
}
|
302 |
}
|
309 |
}
|
303 |
}
|
- |
|
304 |
|
310 |
//store the user @IP in a file (to test if he is still active).
|
305 |
// Store the user @IP in a file (to test if he is still active).
|
311 |
$filename='/var/tmp/havp/current_users.txt';
|
306 |
$filename = '/var/tmp/havp/current_users.txt';
|
312 |
$change_me = 1; //avoid duplicate user @IP
|
- |
|
313 |
if(file_exists($filename)){
|
307 |
if (file_exists($filename)) {
|
314 |
$fichier = fopen($filename, "r");
|
308 |
$current_users_file = fopen($filename, 'r');
|
315 |
$content = file($filename);
|
309 |
$content = file($filename);
|
- |
|
310 |
fclose($current_users_file);
|
316 |
if (empty($content))
|
311 |
if (empty($content)) {
|
317 |
{
|
- |
|
318 |
file_put_contents($filename, $_SERVER['REMOTE_ADDR']);
|
312 |
file_put_contents($filename, $_SERVER['REMOTE_ADDR']);
|
319 |
}
|
- |
|
320 |
else
|
313 |
} else {
|
321 |
{
|
314 |
$change_me = 1; // avoid duplicate user @IP
|
322 |
// if we found duplicate IP, we will not write user @IP (just set change_me = 0)
|
315 |
// if we found duplicate IP, we will not write user @IP (just set change_me = 0)
|
323 |
foreach($content as $line){
|
316 |
foreach ($content as $line) {
|
324 |
$line = preg_replace('/\s+/', '', $line);
|
317 |
$line = preg_replace('/\s+/', '', $line);
|
325 |
if($line == $_SERVER['REMOTE_ADDR'])
|
318 |
if ($line === $_SERVER['REMOTE_ADDR']) {
|
326 |
{
|
- |
|
327 |
$change_me = 0;
|
319 |
$change_me = 0;
|
328 |
}
|
320 |
}
|
329 |
}
|
321 |
}
|
330 |
// if user @IP does not exist, we write it
|
322 |
// if user @IP does not exist, we write it
|
331 |
if($change_me)
|
323 |
if ($change_me) {
|
332 |
{
|
- |
|
333 |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL , FILE_APPEND);
|
324 |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL, FILE_APPEND);
|
334 |
}
|
325 |
}
|
335 |
}
|
326 |
}
|
336 |
}
|
- |
|
337 |
else
|
327 |
} else {
|
338 |
{
|
- |
|
339 |
//we create filename and we write user @IP.
|
328 |
// we create filename and we write user @IP.
|
340 |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL);
|
329 |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL);
|
341 |
}
|
330 |
}
|
342 |
}
|
331 |
}
|
343 |
}
|
332 |
}
|
- |
|
333 |
|
- |
|
334 |
// Cleaning the cache
|
- |
|
335 |
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
|
- |
|
336 |
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
- |
|
337 |
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
- |
|
338 |
header('Cache-Control: post-check=0, pre-check=0', false);
|
- |
|
339 |
header('Pragma: no-cache');
|
344 |
?>
|
340 |
?>
|
345 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
341 |
<!DOCTYPE html>
|
346 |
<html>
|
342 |
<html>
|
347 |
<!-- written by steweb57 & Rexy -->
|
- |
|
348 |
<head>
|
343 |
<head>
|
349 |
<title>Alcasar - <?php echo $organisme; ?></title>
|
- |
|
350 |
<meta http-equiv="Cache-control" content="no-cache">
|
344 |
<meta charset="UTF-8">
|
351 |
<meta http-equiv="Pragma" content="no-cache">
|
345 |
<title>ALCASAR - <?= $organisme ?></title>
|
352 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
346 |
<link type="text/css" href="css/status.css" rel="stylesheet">
|
353 |
<script type="text/javascript" src="./js/ChilliLibrary.js"></script>
|
347 |
<script src="js/ChilliLibrary.js"></script>
|
354 |
<script type="text/javascript" src="./js/statusControler.js"></script>
|
348 |
<script src="js/statusControler.js"></script>
|
355 |
<link type="text/css" href="./css/status.css" rel="stylesheet">
|
- |
|
356 |
</head>
|
349 |
</head>
|
357 |
<body>
|
350 |
<body>
|
358 |
<div id="Chilli">
|
351 |
<div id="Chilli">
|
359 |
<div id="locationName"></div>
|
352 |
<div id="locationName"></div>
|
360 |
<div id="chilliPage">
|
353 |
<div id="chilliPage">
|
361 |
<div id="loggedOutPage" class="c1">
|
354 |
<div id="loggedOutPage" class="c1">
|
362 |
<table id="disconnectTable">
|
355 |
<table id="disconnectTable">
|
363 |
<tr>
|
356 |
<tr>
|
364 |
<td><img height="150" src="./images/logo-alcasar.png" alt="logo"></td>
|
357 |
<td><img height="150" src="images/logo-alcasar.png" alt="logo"></td>
|
365 |
<td><p class="text_auth"><?php echo $l_loggedout; ?></p></td>
|
358 |
<td><p class="text_auth"><?= $l_loggedout ?></p></td>
|
366 |
</tr>
|
359 |
</tr>
|
367 |
</table>
|
360 |
</table>
|
368 |
</div>
|
361 |
</div>
|
369 |
<div id="statusPage" class="c1">
|
362 |
<div id="statusPage" class="c1">
|
370 |
<table border="0" id="statusTable">
|
363 |
<table border="0" id="statusTable">
|
371 |
<tr>
|
364 |
<tr>
|
372 |
<td colspan="2">
|
365 |
<td colspan="2">
|
373 |
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
366 |
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
374 |
<tr>
|
367 |
<tr>
|
375 |
<td valign="top" rowspan="4">
|
368 |
<td valign="top" rowspan="4">
|
376 |
<img height="150" src="./images/logo-alcasar.png" alt="logo">
|
369 |
<img height="150" src="images/logo-alcasar.png" alt="logo">
|
377 |
</td>
|
370 |
</td>
|
378 |
<td class="text_auth_welcom">
|
371 |
<td class="text_auth_welcom">
|
379 |
<?php echo $l_login1; ?>
|
372 |
<?= $l_login1 ?>
|
380 |
</td>
|
373 |
</td>
|
381 |
</tr>
|
374 |
</tr>
|
382 |
<tr>
|
375 |
<tr>
|
383 |
<td class="text_auth">
|
376 |
<td class="text_auth">
|
384 |
<?php echo "$l_welcome <br> $cn";?>
|
377 |
<?= $l_welcome ?><br><?= $cn ?>
|
385 |
</td>
|
378 |
</td>
|
386 |
</tr>
|
379 |
</tr>
|
387 |
<tr>
|
380 |
<tr>
|
388 |
<td class="alert">
|
381 |
<td class="alert">
|
389 |
<?php if(isset($a_connection))echo $a_connection; ?>
|
382 |
<?= ((isset($a_connection)) ? $a_connection : '') ?>
|
390 |
</td>
|
383 |
</td>
|
391 |
</tr>
|
384 |
</tr>
|
392 |
<tr>
|
385 |
<tr>
|
393 |
<td colspan="2" align="center" class="link_logout">
|
386 |
<td colspan="2" align="center" class="link_logout">
|
394 |
<a href="#" onclick="return logoutWithConfirmation('<?php echo $l_logout_question;?>');" class="lien_deco"><?php echo $l_logout; ?></a>
|
387 |
<a href="#" onclick="return logoutWithConfirmation('<?= $l_logout_question ?>');" class="lien_deco"><?= $l_logout ?></a>
|
395 |
</td>
|
388 |
</td>
|
396 |
</tr>
|
389 |
</tr>
|
397 |
</table>
|
390 |
</table>
|
398 |
</td>
|
391 |
</td>
|
399 |
</tr>
|
392 |
</tr>
|
400 |
<!--tr id="connectRow">
|
393 |
<!--
|
401 |
<td id="statusMessageLabel" class="chilliLabel"><strong><?php echo $l_state_label; ?></strong></td>
|
394 |
<tr id="connectRow">
|
402 |
<td id="statusMessage" class="chilliValue">Connected</td>
|
395 |
<td id="statusMessageLabel" class="chilliLabel"><strong><?= $l_state_label ?></strong></td>
|
403 |
</tr-->
|
396 |
<td id="statusMessage" class="chilliValue">Connected</td>
|
404 |
<!--tr id="sessionIdRow">
|
397 |
</tr>
|
405 |
<td id="sessionIdLabel" class="chilliLabel"><strong><?php echo $l_session_id_label; ?></strong></td>
|
398 |
<tr id="sessionIdRow">
|
406 |
<td id="sessionId" class="chilliValue"><?php echo $l_not_available; ?></td>
|
399 |
<td id="sessionIdLabel" class="chilliLabel"><strong><?= $l_session_id_label ?></strong></td>
|
407 |
</tr-->
|
400 |
<td id="sessionId" class="chilliValue"><?= $l_not_available ?></td>
|
408 |
<tr id="sessionTimeoutRow">
|
401 |
</tr>
|
409 |
<td id="sessionTimeoutLabel" class="chilliLabel"><?php echo $l_max_session_time_label; ?></td>
|
402 |
-->
|
410 |
<td id="sessionTimeout" class="chilliValue"><?php echo $l_not_available; ?></td>
|
403 |
<tr id="sessionTimeoutRow">
|
411 |
</tr>
|
404 |
<td id="sessionTimeoutLabel" class="chilliLabel"><?= $l_max_session_time_label ?></td>
|
412 |
<tr id="idleTimeoutRow">
|
405 |
<td id="sessionTimeout" class="chilliValue"><?= $l_not_available ?></td>
|
413 |
<td id="idleTimeoutLabel" class="chilliLabel"><?php echo $l_max_idle_time_label; ?></td>
|
406 |
</tr>
|
414 |
<td id="idleTimeout" class="chilliValue"><?php echo $l_not_available; ?></td>
|
407 |
<tr id="idleTimeoutRow">
|
415 |
</tr>
|
408 |
<td id="idleTimeoutLabel" class="chilliLabel"><?= $l_max_idle_time_label ?></td>
|
416 |
<tr id="startTimeRow">
|
409 |
<td id="idleTimeout" class="chilliValue"><?= $l_not_available ?></td>
|
417 |
<td id="startTimeLabel" class="chilliLabel"><?php echo $l_start_time_label; ?></td>
|
410 |
</tr>
|
418 |
<td id="startTime" class="chilliValue"><?php echo $l_not_available; ?></td>
|
411 |
<tr id="startTimeRow">
|
419 |
</tr>
|
412 |
<td id="startTimeLabel" class="chilliLabel"><?= $l_start_time_label ?></td>
|
420 |
<tr id="sessionTimeRow">
|
413 |
<td id="startTime" class="chilliValue"><?= $l_not_available ?></td>
|
421 |
<td id="sessionTimeLabel" class="chilliLabel"><?php echo $l_session_time_label; ?></td>
|
414 |
</tr>
|
422 |
<td id="sessionTime" class="chilliValue"><?php echo $l_not_available; ?></td>
|
415 |
<tr id="sessionTimeRow">
|
423 |
</tr>
|
416 |
<td id="sessionTimeLabel" class="chilliLabel"><?= $l_session_time_label ?></td>
|
424 |
<tr id="idleTimeRow">
|
417 |
<td id="sessionTime" class="chilliValue"><?= $l_not_available ?></td>
|
425 |
<td id="idleTimeLabel" class="chilliLabel"><?php echo $l_idle_time_label; ?></td>
|
418 |
</tr>
|
426 |
<td id="idleTime" class="chilliValue"><?php echo $l_not_available; ?></td>
|
419 |
<tr id="idleTimeRow">
|
427 |
</tr>
|
420 |
<td id="idleTimeLabel" class="chilliLabel"><?= $l_idle_time_label ?></td>
|
428 |
<tr id="inputOctetsRow">
|
421 |
<td id="idleTime" class="chilliValue"><?= $l_not_available ?></td>
|
429 |
<td id="inputOctetsLabel" class="chilliLabel"><?php echo $l_downloaded_label; ?></td>
|
422 |
</tr>
|
430 |
<td id="inputOctets" class="chilliValue"><?php echo $l_not_available; ?></td>
|
423 |
<tr id="inputOctetsRow">
|
431 |
</tr>
|
424 |
<td id="inputOctetsLabel" class="chilliLabel"><?= $l_downloaded_label ?></td>
|
432 |
<tr id="outputOctetsRow">
|
425 |
<td id="inputOctets" class="chilliValue"><?= $l_not_available ?></td>
|
433 |
<td id="outputOctetsLabel" class="chilliLabel"><?php echo $l_uploaded_label; ?></td>
|
426 |
</tr>
|
434 |
<td id="outputOctets" class="chilliValue"><?php echo $l_not_available; ?></td>
|
427 |
<tr id="outputOctetsRow">
|
435 |
</tr>
|
428 |
<td id="outputOctetsLabel" class="chilliLabel"><?= $l_uploaded_label ?></td>
|
436 |
<!--tr id="originalURLRow">
|
429 |
<td id="outputOctets" class="chilliValue"><?= $l_not_available ?></td>
|
437 |
<td id="originalURLLabel" class="chilliLabel"><?php echo $l_original_url_label; ?></td>
|
430 |
</tr>
|
438 |
<td id="originalURL" class="chilliValue"><?php echo $l_not_available; ?></td>
|
431 |
<!--
|
439 |
</tr-->
|
432 |
<tr id="originalURLRow">
|
440 |
<tr>
|
433 |
<td id="originalURLLabel" class="chilliLabel"><?= $l_original_url_label ?></td>
|
441 |
<td colspan=2 id="conHistoryLabel" class="chilliLabel"><?php echo $l_conn_history; ?></td>
|
434 |
<td id="originalURL" class="chilliValue"><?= $l_not_available ?></td>
|
442 |
</tr>
|
435 |
</tr>
|
443 |
<tr id="conHistoryRow">
|
436 |
-->
|
444 |
<td colspan=2 id="conHistory" class="chilliValue"><?php echo $connection_history; ?></td>
|
437 |
<tr>
|
445 |
</tr>
|
438 |
<td colspan="2" id="conHistoryLabel" class="chilliLabel"><?= $l_conn_history ?></td>
|
446 |
<tr>
|
439 |
</tr>
|
447 |
<td colspan=2 id="close-warning">(<?php echo $l_close_warning; ?>)</td>
|
440 |
<tr id="conHistoryRow">
|
448 |
</tr>
|
441 |
<td colspan="2" id="conHistory" class="chilliValue"><?= $connection_history ?></td>
|
449 |
</table>
|
442 |
</tr>
|
450 |
</div>
|
443 |
<tr>
|
451 |
<div id="waitPage">
|
444 |
<td colspan="2" id="close-warning">(<?= $l_close_warning ?>)</td>
|
452 |
<table id="waitTable">
|
445 |
</tr>
|
453 |
<tr>
|
446 |
</table>
|
454 |
<td><img height="150" src="./images/logo-alcasar.png" alt="logo"></td>
|
447 |
</div>
|
455 |
<td><p class="text_auth"><img src="./images/wait.gif" width="16" height="16" class="wait" alt="<?php echo $l_wait; ?>"><?php echo $l_wait; ?></p></td>
|
448 |
<div id="waitPage">
|
456 |
</tr>
|
449 |
<table id="waitTable">
|
457 |
</table>
|
450 |
<tr>
|
458 |
</div>
|
451 |
<td><img height="150" src="images/logo-alcasar.png" alt="logo"></td>
|
459 |
<div id="errorPage">
|
452 |
<td><p class="text_auth"><img src="images/wait.gif" width="16" height="16" class="wait" alt="<?= $l_wait ?>"><?= $l_wait ?></p></td>
|
460 |
<table id="errorTable">
|
453 |
</tr>
|
461 |
<tr>
|
454 |
</table>
|
462 |
<td><img height="150" src="./images/logo-alcasar.png" alt="logo"></td>
|
455 |
</div>
|
463 |
<td><span id="errorMessage"><?php echo $l_error; ?></span></td>
|
456 |
<div id="errorPage">
|
464 |
</tr>
|
457 |
<table id="errorTable">
|
465 |
</table>
|
458 |
<tr>
|
466 |
</div>
|
459 |
<td><img height="150" src="images/logo-alcasar.png" alt="logo"></td>
|
467 |
</div>
|
460 |
<td><span id="errorMessage"><?= $l_error ?></span></td>
|
468 |
<!--div id="debugPage" style="display:inline;">
|
461 |
</tr>
|
469 |
<textarea id="debugarea" rows="20" cols="60">
|
462 |
</table>
|
470 |
</textarea>
|
463 |
</div>
|
471 |
</div-->
|
464 |
</div>
|
472 |
</div>
|
465 |
</div>
|
473 |
</body>
|
466 |
</body>
|
474 |
</html>
|
467 |
</html>
|