Subversion Repositories ALCASAR

Rev

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

Rev 1999 Rev 2010
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: index.php 1999 2016-07-19 08:14:38Z richard $
2
# $Id: index.php 2010 2016-07-26 14:08:50Z raphael.pion $
3
#
3
#
4
# index.php for ALCASAR bu Rexy
4
# index.php for ALCASAR bu Rexy
5
# UI & css style by stephane ERARD
5
# UI & css style by stephane ERARD
6
# The contents of this file may be used under the terms of the GNU
6
# The contents of this file may be used under the terms of the GNU
7
# General Public License Version 2, provided that the above copyright
7
# General Public License Version 2, provided that the above copyright
Line 81... Line 81...
81
	$time[2] = $temp % 60 ;				// seconds
81
	$time[2] = $temp % 60 ;				// seconds
82
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
82
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
83
	return $time[0]." h ".$time[1]." m ".$time[2]." s";
83
	return $time[0]." h ".$time[1]." m ".$time[2]." s";
84
}
84
}
85
 
85
 
-
 
86
//if user need to be warn
-
 
87
if(isset($_GET['warn']) && isset($_GET['url']))
-
 
88
{
-
 
89
	$direct_access = False;
-
 
90
}
-
 
91
 
-
 
92
 
86
# If the user is connected : retrieve the 3 last connexions
93
# If the user is connected : retrieve the 3 last connexions
87
if ((isset ($user[4])) && ($user[4] != "0")){
94
if ((isset ($user[4])) && ($user[4] != "0")){
-
 
95
 
-
 
96
	if(isset($_GET['redirect'])) # if user has been warned, we redirect him to his website
-
 
97
	{
-
 
98
		$redir = "http://".$_GET['url'];  
-
 
99
		header("Location: $_GET[url]",TRUE,307);
-
 
100
		exit; 
-
 
101
	}
-
 
102
 
-
 
103
 
88
	if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
104
	if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
89
		include_once("/etc/freeradius-web/config.php");
105
		include_once("/etc/freeradius-web/config.php");
90
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
106
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
-
 
107
		
91
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
108
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
92
		$link = @da_sql_pconnect($config); // on affiche pas les erreurs
109
		$link = @da_sql_pconnect($config); // on affiche pas les erreurs
93
		if ($link){
110
		if ($link){
94
			$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
111
			$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
95
			
112
			
Line 125... Line 142...
125
		exit; 
142
		exit; 
126
	}
143
	}
127
	if ($ipset_not_auth_yet[0] == '1'){ #if user not_auth_yet still here (index.php), we force DNS resquest.
144
	if ($ipset_not_auth_yet[0] == '1'){ #if user not_auth_yet still here (index.php), we force DNS resquest.
128
		 echo "<script>window.location.reload(true)</script>"; # force DNS request
145
		 echo "<script>window.location.reload(true)</script>"; # force DNS request
129
	}	
146
	}	
-
 
147
	
-
 
148
	
130
}
149
}
131
# Choice of language
150
# Choice of language
132
if($Language == 'fr'){
151
if($Language == 'fr'){
133
  $l_access_denied = "Contrôle d'accès";
152
  $l_access_denied = "Contrôle d'accès";
134
  $l_access_welcome = "Bienvenue sur ALCASAR";
153
  $l_access_welcome = "Bienvenue sur ALCASAR";
Line 167... Line 186...
167
  $l_sms_explain = "Vous redirige vers une la page explicative de l'auto enregistrement par SMS.<br><br><strong>Identifiant:</strong> votre numéro de téléphone<br><strong>Mot de passe:</strong> votre message";
186
  $l_sms_explain = "Vous redirige vers une la page explicative de l'auto enregistrement par SMS.<br><br><strong>Identifiant:</strong> votre numéro de téléphone<br><strong>Mot de passe:</strong> votre message";
168
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
187
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
169
  $l_service_sms = "Service SMS actif";
188
  $l_service_sms = "Service SMS actif";
170
  $l_service_sms_n = "Service SMS non actif";
189
  $l_service_sms_n = "Service SMS non actif";
171
  $l_acc_sms = "Auto enregistrement par SMS";
190
  $l_acc_sms = "Auto enregistrement par SMS";
-
 
191
  $l_explain_warn = "L'administrateur a créé une archive contenant vos journaux de connexion dans le cadre d'une affaire judiciaire.";
-
 
192
  $l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>Je comprends et je souhaite continuer ma navigation.</a>";
-
 
193
  $l_title_warn="Cher utilisateur, ";
-
 
194
  $l_explain_warn_name="Une personne sous le nom de ";
-
 
195
  $l_explain_warn_ip="sous cette IP : ";
-
 
196
  $l_explain_warn_date="a consulté vos journaux de connexion le ";
-
 
197
  $l_explain_warn_reason="en émettant la raison suivante : ";
172
}
198
}
173
else if($Language == 'pt'){
199
else if($Language == 'pt'){
174
  $l_access_denied = "Controle de acesso";
200
  $l_access_denied = "Controle de acesso";
175
  $l_access_welcome = "Bem-vindo ao Alcasar";
201
  $l_access_welcome = "Bem-vindo ao Alcasar";
176
  $l_access_unavailable = "ACESSO INDISPONÍVEL";
202
  $l_access_unavailable = "ACESSO INDISPONÍVEL";
Line 208... Line 234...
208
  $l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
234
  $l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
209
  $l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
235
  $l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
210
  $l_service_sms = "SMS service enable";
236
  $l_service_sms = "SMS service enable";
211
  $l_service_sms_n = "SMS service disable";
237
  $l_service_sms_n = "SMS service disable";
212
  $l_acc_sms = "Auto registration by SMS";
238
  $l_acc_sms = "Auto registration by SMS";
-
 
239
  $l_explain_warn = "El administrador ha creado un archivo que contiene los periódicos de inicio de sesión como parte de un proceso judicial."; 
-
 
240
  $l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>Lo comprendo y deseo continuar mi navegación.</a>";
-
 
241
  $l_title_warn="Estimado usuario,";
-
 
242
  $l_explain_warn_name="El usario ";
-
 
243
  $l_explain_warn_ip="con este IP : ";
-
 
244
  $l_explain_warn_date="consultó a sus registros de conexión el ";
-
 
245
  $l_explain_warn_reason="con la siguiente razón : ";
213
}
246
}
214
else {
247
else {
215
  $l_access_denied = "Access control";
248
  $l_access_denied = "Access control";
216
  $l_access_welcome = "Welcome on ALCASAR";
249
  $l_access_welcome = "Welcome on ALCASAR";
217
  $l_access_unavailable = "ACCESS UNAVAILABLE";
250
  $l_access_unavailable = "ACCESS UNAVAILABLE";
Line 249... Line 282...
249
  $l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
282
  $l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
250
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
283
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
251
  $l_service_sms = "SMS service enable";
284
  $l_service_sms = "SMS service enable";
252
  $l_service_sms_n = "SMS service disable";
285
  $l_service_sms_n = "SMS service disable";
253
  $l_acc_sms = "Auto registration by SMS";
286
  $l_acc_sms = "Auto registration by SMS";
-
 
287
  $l_explain_warn = "The administrator created an archive which contains your imputabilities logs for a judicial investigation.";
-
 
288
  $l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>I understand and I wish to continue.</a>";
-
 
289
  $l_title_warn="Dear user,";
-
 
290
  $l_explain_warn_name="Someone called ";
-
 
291
  $l_explain_warn_ip="with this IP : ";
-
 
292
  $l_explain_warn_date="has read your connexion logs at ";
-
 
293
  $l_explain_warn_reason="because : ";
254
}
294
}
255
 
295
 
256
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
296
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
257
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
297
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
258
 
298
 
Line 316... Line 356...
316
	if ($network_pb) {
356
	if ($network_pb) {
317
		echo "	<span>$l_explain_net_pb</span>";
357
		echo "	<span>$l_explain_net_pb</span>";
318
		}
358
		}
319
	}
359
	}
320
	else {
360
	else {
-
 
361
		#if user need to be warn about that someone who read his logs
-
 
362
		if(isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1')
-
 
363
		{
-
 
364
		echo"
-
 
365
			<div id=\"cadre_titre\" class=\"titre_refus\">
-
 
366
			<p id=\"acces_controle\" class=\"titre_refus\">$l_title_warn</p>";
-
 
367
		}
-
 
368
		else
-
 
369
		{
321
		echo"
370
		echo"
322
			<div id=\"cadre_titre\" class=\"titre_refus\">
371
			<div id=\"cadre_titre\" class=\"titre_refus\">
323
				<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
372
			<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
-
 
373
		}
324
	}
374
	}
325
?>
375
?>
326
			<div id="boite_logo">
376
			<div id="boite_logo">
327
				<img src="<?php echo "$img_rep$img_organisme"; ?>">
377
				<img src="<?php echo "$img_rep$img_organisme"; ?>">
328
			</div>
378
			</div>
Line 394... Line 444...
394
			$sms_div_over
444
			$sms_div_over
395
			<div id=\"box_info\">
445
			<div id=\"box_info\">
396
			</div>";
446
			</div>";
397
	}
447
	}
398
else {
448
else {
-
 
449
	#if user need to be warn about that someone who read his logs
-
 
450
	if(isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1')
-
 
451
	{
-
 
452
		
-
 
453
		
-
 
454
	$filename="/var/www/html/acc/backup/log_info.txt";
-
 
455
	$l_explain_warn="";
-
 
456
	if(file_exists($filename)){
-
 
457
		$fichier = fopen($filename, "r");
-
 
458
		$content = file($filename);
-
 
459
        	foreach($content as $line){
-
 
460
			$infos=explode("|||", $line);
-
 
461
			$log_date=$infos[0];	
-
 
462
			$log_user=$infos[1];	
-
 
463
			$log_reason=$infos[2];	
-
 
464
			$log_ip=$infos[3];	
-
 
465
		}
-
 
466
 
-
 
467
		$l_explain_warn="$l_explain_warn_name$log_user ( $l_explain_warn_ip$log_ip ) $l_explain_warn_date$log_date $l_explain_warn_reason$log_reason";
-
 
468
	}
-
 
469
	else
-
 
470
	{
-
 
471
		echo "Log error!";
-
 
472
	}
-
 
473
	
-
 
474
	
-
 
475
	echo "
-
 
476
		<div id=\"box_refuse\">
-
 
477
			<img src=\"$img_rep$img_warning\">
-
 
478
			<p>$l_explain_warn</p>
-
 
479
 
-
 
480
		</div>
-
 
481
		<div id=\"liens_redir\">
-
 
482
			<p>$l_continue_link</p>
-
 
483
		</div>";
-
 
484
 
-
 
485
	}
-
 
486
	else
-
 
487
	{
399
		echo "
488
		echo "
400
			<div id=\"box_refuse\">
489
			<div id=\"box_refuse\">
401
				<img src=\"$img_rep$img_false\">
490
				<img src=\"$img_rep$img_false\">
402
				<p>$l_explain</p>
491
				<p>$l_explain</p>
403
			</div>
492
			</div>
404
			<div id=\"liens_redir\">
493
			<div id=\"liens_redir\">
405
				<p>$l_back_page</p>
494
				<p>$l_back_page</p>
406
			</div>";
495
			</div>";
407
		}
496
	}
-
 
497
}
408
	if (($network_pb)&&(! $direct_access)) {
498
	if (($network_pb)&&(! $direct_access)) {
409
	echo "	<span>Diagnostic : $diagnostic</span>";
499
	echo "	<span>Diagnostic : $diagnostic</span>";
410
	}
500
	}
411
?>
501
?>
412
		</div>
502
		</div>