Subversion Repositories ALCASAR

Rev

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

Rev 1124 Rev 1249
1
<?php
1
<?php
2
# $Id: index.php 1124 2013-06-21 08:23:00Z crox53 $
2
# $Id: index.php 1249 2013-10-22 22:09:01Z richard $
-
 
3
#
-
 
4
# index.php for ALACASAR captive portal
-
 
5
# by REXY
-
 
6
# UI & css style by stephane ERARD
-
 
7
# The contents of this file may be used under the terms of the GNU
-
 
8
# General Public License Version 2, provided that the above copyright
-
 
9
# notice and this permission notice is included in all copies or
-
 
10
# substantial portions of the software.
-
 
11
/****************************************************************
-
 
12
*			GLOBAL FILE PATHS			*
-
 
13
*****************************************************************/
-
 
14
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
-
 
15
 
-
 
16
/****************************************************************
-
 
17
*			FILE reading test			*
-
 
18
*****************************************************************/
-
 
19
$conf_files=array(CONF_FILE);
-
 
20
foreach ($conf_files as $file){
-
 
21
	if (!file_exists($file)){
-
 
22
		exit("File ".$file." unknown");
-
 
23
	}
-
 
24
	if (!is_readable($file)){
-
 
25
		exit("You don't have read rights on the file ".$file);
-
 
26
	}
-
 
27
}
-
 
28
/****************************************************************
-
 
29
*			Read CONF_FILE				*
-
 
30
*****************************************************************/
-
 
31
$ouvre=fopen(CONF_FILE,"r");
-
 
32
if ($ouvre){
-
 
33
	while (!feof ($ouvre))
-
 
34
	{
-
 
35
		$tampon = fgets($ouvre, 4096);
-
 
36
		if (strpos($tampon,"=")!==false){
-
 
37
			$tmp = explode("=",$tampon);
-
 
38
			$conf[$tmp[0]] = $tmp[1];
-
 
39
		}
-
 
40
	}
-
 
41
}else{
-
 
42
	exit("Error opening the file ".CONF_FILE);
-
 
43
}
-
 
44
fclose($ouvre);
3
$hostname = "alcasar";
45
$hostname = alcasar.$conf["DOMAIN"];
4
$network_pb = False;
46
$network_pb = False;
5
$cert_add = "http://alcasar/certs";
47
$cert_add = "http://$hostname/certs";
6
$direct_access = False;
48
$direct_access = False;
7
$diagnostic = "can't contact the default router";
49
$diagnostic = "can't contact the default router";
8
$remote_ip = ($_SERVER['REMOTE_ADDR']);
50
$remote_ip = ($_SERVER['REMOTE_ADDR']);
9
$tab = array();$user = array();
51
$tab = array();$user = array();
10
$connection_history =  "";
52
$connection_history =  "";
11
$nb_connection_history = 3;
53
$nb_connection_history = 3;
12
 
54
 
13
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
55
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
14
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || preg_match ("/^alcasar/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname/", $_SERVER['HTTP_HOST']))
56
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || preg_match ("/^alcasar/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname/", $_SERVER['HTTP_HOST']))
15
	{
57
	{
16
	$direct_access=True;
58
	$direct_access=True;
17
	exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
59
	exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
18
	$user = explode (" ", $tab[0]);
60
	$user = explode (" ", $tab[0]);
19
	}
61
	}
20
#### Affichage des 3 dernières connexions de $user[5]
62
#### Affichage des 3 dernières connexions de $user[5]
21
function secondsToDuration($seconds = null){
63
function secondsToDuration($seconds = null){
22
	if ($seconds == null) return "";
64
	if ($seconds == null) return "";
23
 
65
 
24
	$temp = $seconds % 3600;
66
	$temp = $seconds % 3600;
25
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
67
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
26
	$time[2] = $temp % 60 ;				// seconds
68
	$time[2] = $temp % 60 ;				// seconds
27
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
69
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
28
	
70
	
29
	return $time[0]." h ".$time[1]." m ".$time[2]." s";
71
	return $time[0]." h ".$time[1]." m ".$time[2]." s";
30
}
72
}
31
 
73
 
32
$l_connected = "connected"; // a traduire (choix de la langue ci-dessous mais nécessitant de $connection_history)
74
$l_connected = "connected"; // a traduire (choix de la langue ci-dessous mais nécessitant de $connection_history)
33
// si on a pas d'accès à la bdd, la page s'affiche quand même correctement
75
// si on a pas d'accès à la bdd, la page s'affiche quand même correctement
34
if ((isset ($user[4])) && ($user[4] != "0")){
76
if ((isset ($user[4])) && ($user[4] != "0")){
35
	if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
77
	if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
36
		include_once("/etc/freeradius-web/config.php");
78
		include_once("/etc/freeradius-web/config.php");
37
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
79
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
38
		
80
		
39
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
81
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
40
		$link = @da_sql_pconnect($config); // on affiche pas les erreurs
82
		$link = @da_sql_pconnect($config); // on affiche pas les erreurs
41
		
83
		
42
		if ($link){
84
		if ($link){
43
			$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
85
			$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
44
			
86
			
45
			if ($res){
87
			if ($res){
46
				$connection_history.= "<ul>";
88
				$connection_history.= "<ul>";
47
				while(($row = @da_sql_fetch_array($res,$config))){
89
				while(($row = @da_sql_fetch_array($res,$config))){
48
					$connected = "";
90
					$connected = "";
49
					if ($row[acctstoptime] == "") $connected = " ($l_connected)";
91
					if ($row[acctstoptime] == "") $connected = " ($l_connected)";
50
					$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row[acctsessiontime]).")'>$row[acctstarttime] (".secondsToDuration($row[acctsessiontime]).") $connected</li>";
92
					$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row[acctsessiontime]).")'>$row[acctstarttime] (".secondsToDuration($row[acctsessiontime]).") $connected</li>";
51
				}
93
				}
52
				$connection_history.="</ul>";
94
				$connection_history.="</ul>";
53
			}
95
			}
54
		}
96
		}
55
	}
97
	}
56
}
98
}
57
####
99
####
58
 
100
 
59
# Choice of language
101
# Choice of language
60
$Language = 'en';
102
$Language = 'en';
61
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
103
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
62
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
104
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
63
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
105
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
64
if($Language == 'fr'){
106
if($Language == 'fr'){
65
  $l_access_denied = "ACC&Egrave;S REFUS&Eacute;";
107
  $l_access_denied = "ACC&Egrave;S REFUS&Eacute;";
66
  $l_access_welcome = "Bienvenue sur ALCASAR";
108
  $l_access_welcome = "Bienvenue sur ALCASAR";
67
  $l_access_unavailable = "ACC&Egrave;S INDISPONIBLE";
109
  $l_access_unavailable = "ACC&Egrave;S INDISPONIBLE";
68
  $l_required_domain = "Site WEB demand&eacute;";
110
  $l_required_domain = "Site WEB demand&eacute;";
69
  $l_explain_acc_access = "Le centre de gestion permet d'administrer le portail. Vous devez poss&eacute;der un compte d'administration ou de gestion pour y acc&eacute;der.";
111
  $l_explain_acc_access = "Le centre de gestion permet d'administrer le portail. Vous devez poss&eacute;der un compte d'administration ou de gestion pour y acc&eacute;der.";
70
  $l_explain_access_deny = "Vous tentez d'acc&eacute;der &agrave; une ressource dont le contenu est r&eacute;put&eacute; contenir des informations inappropri&eacute;es.";
112
  $l_explain_access_deny = "Vous tentez d'acc&eacute;der &agrave; une ressource dont le contenu est r&eacute;put&eacute; contenir des informations inappropri&eacute;es.";
71
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
113
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
72
  $l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
114
  $l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
73
  $l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
115
  $l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
74
  $l_welcome = "Page principale de votre portail captif";
116
  $l_welcome = "Page principale de votre portail captif";
75
  $l_acc_access = "<a href=\"https://$hostname/acc\">Acc&egrave;s au centre de gestion</a>";
117
  $l_acc_access = "<a href=\"https://$hostname/acc\">Acc&egrave;s au centre de gestion</a>";
76
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installer le certificat racine</a>";
118
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installer le certificat racine</a>";
77
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installation du certificat de l'autorit&eacute; racine d'ALCASAR</a>";
119
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installation du certificat de l'autorit&eacute; racine d'ALCASAR</a>";
78
  $l_certif_explain = "Permet l'&eacute;change de donn&eacute;es s&eacute;curis&eacute;es entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistr&eacute; sur votre station de consultation, il est possible que des alertes de s&eacute;curit&eacute;s soient &eacute;mises par votre navigateur.<br><br>";
120
  $l_certif_explain = "Permet l'&eacute;change de donn&eacute;es s&eacute;curis&eacute;es entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistr&eacute; sur votre station de consultation, il est possible que des alertes de s&eacute;curit&eacute;s soient &eacute;mises par votre navigateur.<br><br>";
79
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
121
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
80
  $l_category = "catégorie :";
122
  $l_category = "catégorie :";
81
if ((isset ($user[4])) && ($user[4] == "0")) {
123
if ((isset ($user[4])) && ($user[4] == "0")) {
82
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
124
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
83
	  $l_logout = "<a href=\"http://www.google.fr\">Ouvrir une session Internet</a>";}
125
	  $l_logout = "<a href=\"http://www.google.fr\">Ouvrir une session Internet</a>";}
84
  else {
126
  else {
85
	  if ($user[5] != $user[0]) // authentication exception or not
127
	  if ($user[5] != $user[0]) // authentication exception or not
86
	  {
128
	  {
87
	  	$l_logout_explain = "Ferme la session de l'usager actuellement connect&eacute;. <br><br>Utilisateur connect&eacute; : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history derni&egrave;res connexions :$connection_history";
129
	  	$l_logout_explain = "Ferme la session de l'usager actuellement connect&eacute;. <br><br>Utilisateur connect&eacute; : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history derni&egrave;res connexions :$connection_history";
88
		$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</a>";
130
		$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</a>";
89
	  }
131
	  }
90
	  else
132
	  else
91
	  {
133
	  {
92
		  $l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history last connections :$connection_history";
134
		  $l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history last connections :$connection_history";
93
		  $l_logout = "Information des connexions";
135
		  $l_logout = "Information des connexions";
94
	  }
136
	  }
95
	}
137
	}
96
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
138
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
97
  $l_password_change_explain = "Vous redirige sur la page de changement du mot de passe de votre compte d'acc&egrave;s &agrave; internet.<br><br>Vous devez avoir un compte internet valide.";
139
  $l_password_change_explain = "Vous redirige sur la page de changement du mot de passe de votre compte d'acc&egrave;s &agrave; internet.<br><br>Vous devez avoir un compte internet valide.";
98
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
140
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
99
}
141
}
100
else if($Language == 'pt'){
142
else if($Language == 'pt'){
101
  $l_access_denied = "Acesso negado";
143
  $l_access_denied = "Acesso negado";
102
  $l_access_welcome = "Bem-vindo ao Alcasar";
144
  $l_access_welcome = "Bem-vindo ao Alcasar";
103
  $l_access_unavailable = "ACESSO INDISPONÍVEL";
145
  $l_access_unavailable = "ACESSO INDISPONÍVEL";
104
  $l_required_domain = "Site WEB Obrigatório";
146
  $l_required_domain = "Site WEB Obrigatório";
105
  $l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
147
  $l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
106
  $l_explain_access_deny = "Você tenta se conectar a um recurso cujo conteúdo é considerado inadequado no conteúdo de informações.";
148
  $l_explain_access_deny = "Você tenta se conectar a um recurso cujo conteúdo é considerado inadequado no conteúdo de informações.";
107
  $l_explain_net_pb = "O sistema detectou que o acesso é de risco, não será permitido o acesso";
149
  $l_explain_net_pb = "O sistema detectou que o acesso é de risco, não será permitido o acesso";
108
  $l_contact_access_deny = "Entre em contato com o administrador do sistema de segurança se acha que essa filtragem é abusiva.";
150
  $l_contact_access_deny = "Entre em contato com o administrador do sistema de segurança se acha que essa filtragem é abusiva.";
109
  $l_contact_net_pb = "Entre em contato com a empresa fornecedora de Internet para mais informações";
151
  $l_contact_net_pb = "Entre em contato com a empresa fornecedora de Internet para mais informações";
110
  $l_welcome = "Página do portal";
152
  $l_welcome = "Página do portal";
111
  $l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Controle Center</a>";
153
  $l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Controle Center</a>";
112
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Instalar Certificado Alcasar AC</a>";
154
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Instalar Certificado Alcasar AC</a>";
113
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Instalar Certificado Alcasar AC</a>";
155
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Instalar Certificado Alcasar AC</a>";
114
  $l_certif_explain = "O certificado Permiti a troca de dados seguro entre seu computador e o portal Alcasar.<BR>Se este certificado não estiver incorporado no seu computador, alguns alertas de segurança deverá aparecer no navegador.<br><br>";
156
  $l_certif_explain = "O certificado Permiti a troca de dados seguro entre seu computador e o portal Alcasar.<BR>Se este certificado não estiver incorporado no seu computador, alguns alertas de segurança deverá aparecer no navegador.<br><br>";
115
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
157
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
116
  $l_category = "categoria :";
158
  $l_category = "categoria :";
117
if ((isset ($user[4])) && ($user[4] == "0")) {
159
if ((isset ($user[4])) && ($user[4] == "0")) {
118
	  $l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
160
	  $l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
119
	  $l_logout = "<a href=\"http://www.google.pt\">Abrir uma conexão de Internet</a>";}
161
	  $l_logout = "<a href=\"http://www.google.pt\">Abrir uma conexão de Internet</a>";}
120
  else {
162
  else {
121
	  if ($user[5] != $user[0]) // authentication exception or not
163
	  if ($user[5] != $user[0]) // authentication exception or not
122
	  {
164
	  {
123
		  $l_logout_explain = "Se desejar, feche a conexão do usuário atual conectado.<br> Usuário conectado : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
165
		  $l_logout_explain = "Se desejar, feche a conexão do usuário atual conectado.<br> Usuário conectado : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
124
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
166
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
125
	  }
167
	  }
126
	  else
168
	  else
127
	  {
169
	  {
128
		  $l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
170
		  $l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
129
		  $l_logout = "Informações de conexões";
171
		  $l_logout = "Informações de conexões";
130
	  }
172
	  }
131
  	}
173
  	}
132
  $l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
174
  $l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
133
  $l_password_change_explain = "Você será redirecionado à página de alteração de senha.<br><br> e deverá ter uma conta de usuário valido para efetuar a troca e acessar à Internet.";
175
  $l_password_change_explain = "Você será redirecionado à página de alteração de senha.<br><br> e deverá ter uma conta de usuário valido para efetuar a troca e acessar à Internet.";
134
  $l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
176
  $l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
135
}
177
}
136
else {
178
else {
137
  $l_access_denied = "ACCESS DENIED";
179
  $l_access_denied = "ACCESS DENIED";
138
  $l_access_welcome = "Welcome on ALCASAR";
180
  $l_access_welcome = "Welcome on ALCASAR";
139
  $l_access_unavailable = "ACCESS UNAVAILABLE";
181
  $l_access_unavailable = "ACCESS UNAVAILABLE";
140
  $l_required_domain = "Required WEB site";
182
  $l_required_domain = "Required WEB site";
141
  $l_explain_acc_access = "This center control the portal. You must have an administrative account.";
183
  $l_explain_acc_access = "This center control the portal. You must have an administrative account.";
142
  $l_explain_access_deny = "You try to connect to a resource whose content is deemed to contain inappropriate information.";
184
  $l_explain_access_deny = "You try to connect to a resource whose content is deemed to contain inappropriate information.";
143
  $l_explain_net_pb = "Your portal has just detected that the Internet access is down";
185
  $l_explain_net_pb = "Your portal has just detected that the Internet access is down";
144
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
186
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
145
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
187
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
146
  $l_welcome = "Your captive portal main page";
188
  $l_welcome = "Your captive portal main page";
147
  $l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Control Center</a>";
189
  $l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Control Center</a>";
148
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Install ALCASAR AC Certificate</a>";
190
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Install ALCASAR AC Certificate</a>";
149
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Install ALCASAR AC Certificate</a>";
191
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Install ALCASAR AC Certificate</a>";
150
  $l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>";
192
  $l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>";
151
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
193
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
152
  $l_category = "category :";
194
  $l_category = "category :";
153
if ((isset ($user[4])) && ($user[4] == "0")) {
195
if ((isset ($user[4])) && ($user[4] == "0")) {
154
	  $l_logout_explain = "No Internet consultation session is actualy open on your system";
196
	  $l_logout_explain = "No Internet consultation session is actualy open on your system";
155
	  $l_logout = "<a href=\"http://www.google.com\">Open an Internet session</a>";}
197
	  $l_logout = "<a href=\"http://www.google.com\">Open an Internet session</a>";}
156
  else {
198
  else {
157
	  if ($user[5] != $user[0]) // authentication exception or not
199
	  if ($user[5] != $user[0]) // authentication exception or not
158
	  {
200
	  {
159
		  $l_logout_explain = "Close the session of the user currently connected.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
201
		  $l_logout_explain = "Close the session of the user currently connected.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
160
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
202
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
161
	  }
203
	  }
162
	  else
204
	  else
163
	  {
205
	  {
164
		  $l_logout_explain = "Your system ($user[5]) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
206
		  $l_logout_explain = "Your system ($user[5]) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
165
		  $l_logout = "Connections information";
207
		  $l_logout = "Connections information";
166
	  }
208
	  }
167
  	}
209
  	}
168
  $l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
210
  $l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
169
  $l_password_change_explain = "Redirect you on password change page.<br><br> You should already have an Internet access account.";
211
  $l_password_change_explain = "Redirect you on password change page.<br><br> You should already have an Internet access account.";
170
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
212
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
171
}
213
}
172
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
214
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
173
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
215
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
174
 
216
 
175
# Attribution des icones / images
217
# Attribution des icones / images
176
$img_rep = "images/";
218
$img_rep = "images/";
177
$img_organisme = "organisme.png";
219
$img_organisme = "organisme.png";
178
$img_access = "globe_acces_70.png";
220
$img_access = "globe_acces_70.png";
179
$img_connect = "globe_70.png";
221
$img_connect = "globe_70.png";
180
$img_warning = "globe_warning_70.png";
222
$img_warning = "globe_warning_70.png";
181
$img_pwd = "cle_ombre.png";
223
$img_pwd = "cle_ombre.png";
182
$img_certificate = "certificat.png";
224
$img_certificate = "certificat.png";
183
$img_acc = "logo-alcasar_70.png";
225
$img_acc = "logo-alcasar_70.png";
184
$img_false = "interdit.png";
226
$img_false = "interdit.png";
185
$img_internet = $img_connect;
227
$img_internet = $img_connect;
186
 
228
 
187
if ((isset ($user[4])) && ($user[4] == "0")) {
229
if ((isset ($user[4])) && ($user[4] == "0")) {
188
	if (! $network_pb) {
230
	if (! $network_pb) {
189
		$img_internet = $img_access;
231
		$img_internet = $img_access;
190
		}
232
		}
191
		else {
233
		else {
192
		$img_internet = $img_warning;
234
		$img_internet = $img_warning;
193
	}
235
	}
194
}
236
}
195
else {
237
else {
196
	$img_internet = $img_connect;
238
	$img_internet = $img_connect;
197
}
239
}
198
 
240
 
199
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
241
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
200
?>
242
?>
201
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
243
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
202
	<html>
244
	<html>
203
	<head>
245
	<head>
204
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
246
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
205
	<title>ALCASAR - <?php echo $l_title; ?></title>
247
	<title>ALCASAR - <?php echo $l_title; ?></title>
206
	<meta http-equiv="Cache-control" content="no-cache">
248
	<meta http-equiv="Cache-control" content="no-cache">
207
	<meta http-equiv="Pragma" content="no-cache">
249
	<meta http-equiv="Pragma" content="no-cache">
208
	<link rel="stylesheet" type="text/css" href="css/style_intercept.css">
250
	<link rel="stylesheet" type="text/css" href="css/style_intercept.css">
209
	<script type="text/javascript">
251
	<script type="text/javascript">
210
		function valoriserDiv5(param){
252
		function valoriserDiv5(param){
211
			document.getElementById("box_info").innerHTML = param.innerHTML;
253
			document.getElementById("box_info").innerHTML = param.innerHTML;
212
		}
254
		}
213
	</script>
255
	</script>
214
</head>
256
</head>
215
<body onload="valoriserDiv5(text_conn);">
257
<body onload="valoriserDiv5(text_conn);">
216
<?php
258
<?php
217
if ($direct_access){
259
if ($direct_access){
218
	echo "
260
	echo "
219
		<div id=\"cadre_titre\" class=\"titre_controle\">
261
		<div id=\"cadre_titre\" class=\"titre_controle\">
220
			<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
262
			<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
221
	if ($network_pb) {
263
	if ($network_pb) {
222
		echo "	<span>$l_explain_net_pb</span>";
264
		echo "	<span>$l_explain_net_pb</span>";
223
		}
265
		}
224
	}
266
	}
225
	else {
267
	else {
226
		echo"
268
		echo"
227
			<div id=\"cadre_titre\" class=\"titre_refus\">
269
			<div id=\"cadre_titre\" class=\"titre_refus\">
228
				<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
270
				<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
229
	}
271
	}
230
?>
272
?>
231
			<div id="boite_logo">
273
			<div id="boite_logo">
232
				<img src="images/organisme.png">
274
				<img src="images/organisme.png">
233
			</div>
275
			</div>
234
		</div>
276
		</div>
235
		<div id="contenu_acces">
277
		<div id="contenu_acces">
236
			<div id="box_url">
278
			<div id="box_url">
237
<?php 
279
<?php 
238
if (! $direct_access){
280
if (! $direct_access){
239
	$pattern = preg_replace('/www./','',$_SERVER['HTTP_HOST']);
281
	$pattern = preg_replace('/www./','',$_SERVER['HTTP_HOST']);
240
	chdir('/etc/dansguardian/lists/blacklists/');
282
	chdir('/etc/dansguardian/lists/blacklists/');
241
	$domain_bl = exec("grep -Re ^$pattern$ *");
283
	$domain_bl = exec("grep -Re ^$pattern$ *");
242
	$s = explode("/",$domain_bl);
284
	$s = explode("/",$domain_bl);
243
	echo "$l_required_domain : $_SERVER[HTTP_HOST] ($l_category $s[0])";
285
	echo "$l_required_domain : $_SERVER[HTTP_HOST] ($l_category $s[0])";
244
}
286
}
245
?>
287
?>
246
			</div>
288
			</div>
247
 
289
 
248
<?php
290
<?php
249
if ($direct_access){
291
if ($direct_access){
250
	echo "	<div id=\"box_bienvenue\">
292
	echo "	<div id=\"box_bienvenue\">
251
				$l_welcome
293
				$l_welcome
252
			</div>
294
			</div>
253
			<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
295
			<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
254
				<span>$l_logout</span>
296
				<span>$l_logout</span>
255
				<img src=\"$img_rep$img_internet\">
297
				<img src=\"$img_rep$img_internet\">
256
			</div>
298
			</div>
257
			<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
299
			<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
258
				<span>$l_install_certif</span>
300
				<span>$l_install_certif</span>
259
				<img src=\"$img_rep$img_certificate\">
301
				<img src=\"$img_rep$img_certificate\">
260
			</div>
302
			</div>
261
			<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
303
			<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
262
				<img src=\"$img_rep$img_pwd\">
304
				<img src=\"$img_rep$img_pwd\">
263
				<span>$l_password_change</span>
305
				<span>$l_password_change</span>
264
			</div>		
306
			</div>		
265
			<div class=\"box_menu\" id=\"box_acc\" onmouseover=\"valoriserDiv5(text_acc);\">
307
			<div class=\"box_menu\" id=\"box_acc\" onmouseover=\"valoriserDiv5(text_acc);\">
266
				<span>$l_acc_access</span>
308
				<span>$l_acc_access</span>
267
				<img src=\"$img_rep$img_acc\">
309
				<img src=\"$img_rep$img_acc\">
268
			</div>
310
			</div>
269
			<div class=\"div-cache\" id=\"text_conn\">
311
			<div class=\"div-cache\" id=\"text_conn\">
270
				<h2>$l_logout</h2>
312
				<h2>$l_logout</h2>
271
				<p>$l_logout_explain</p>
313
				<p>$l_logout_explain</p>
272
				<img src=\"$img_rep$img_internet\">
314
				<img src=\"$img_rep$img_internet\">
273
			</div>
315
			</div>
274
			<div class=\"div-cache\" id=\"text_certif\">
316
			<div class=\"div-cache\" id=\"text_certif\">
275
				<h2>$l_install_certif_more</h2>
317
				<h2>$l_install_certif_more</h2>
276
				<p>$l_certif_explain $l_certif_explain_help</p>
318
				<p>$l_certif_explain $l_certif_explain_help</p>
277
				<img src=\"$img_rep$img_certificate\">				
319
				<img src=\"$img_rep$img_certificate\">				
278
			</div>
320
			</div>
279
			<div class=\"div-cache\" id=\"text_mdp\">
321
			<div class=\"div-cache\" id=\"text_mdp\">
280
				<h2>$l_password_change</h2>
322
				<h2>$l_password_change</h2>
281
				<p>$l_password_change_explain</p>
323
				<p>$l_password_change_explain</p>
282
				<img src=\"$img_rep$img_pwd\">
324
				<img src=\"$img_rep$img_pwd\">
283
			</div>
325
			</div>
284
			<div class=\"div-cache\" id=\"text_acc\">
326
			<div class=\"div-cache\" id=\"text_acc\">
285
				<h2>$l_acc_access</h2>
327
				<h2>$l_acc_access</h2>
286
				<p>$l_explain</p>
328
				<p>$l_explain</p>
287
				<img src=\"$img_rep$img_acc\">
329
				<img src=\"$img_rep$img_acc\">
288
			</div>
330
			</div>
289
			<div id=\"box_info\">
331
			<div id=\"box_info\">
290
			</div>";
332
			</div>";
291
	}
333
	}
292
	else {
334
	else {
293
		echo "
335
		echo "
294
			<div id=\"box_refuse\">
336
			<div id=\"box_refuse\">
295
				<img src=\"$img_rep$img_false\">
337
				<img src=\"$img_rep$img_false\">
296
				<p>$l_explain</p>
338
				<p>$l_explain</p>
297
			</div>
339
			</div>
298
			<div id=\"liens_redir\">
340
			<div id=\"liens_redir\">
299
				<p>$l_back_page</p>
341
				<p>$l_back_page</p>
300
			</div>";
342
			</div>";
301
		}
343
		}
302
	if (($network_pb)&&(! $direct_access)) {
344
	if (($network_pb)&&(! $direct_access)) {
303
	echo "	<span>Diagnostic : $diagnostic</span>";
345
	echo "	<span>Diagnostic : $diagnostic</span>";
304
	}
346
	}
305
?>
347
?>
306
		</div>
348
		</div>
307
	</body>
349
	</body>
308
</html>
350
</html>
309
 
351