Subversion Repositories ALCASAR

Rev

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

Rev 1996 Rev 1999
1
<?php
1
<?php
2
# $Id: index.php 1996 2016-07-18 20:58:49Z richard $
2
# $Id: index.php 1999 2016-07-19 08:14:38Z richard $
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
8
# notice and this permission notice is included in all copies or
8
# notice and this permission notice is included in all copies or
9
# substantial portions of the software.
9
# substantial portions of the software.
10
/****************************************************************
10
/****************************************************************
11
*			GLOBAL FILE PATHS			*
11
*			GLOBAL FILE PATHS			*
12
*****************************************************************/
12
*****************************************************************/
13
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
13
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
14
 
14
 
15
/****************************************************************
15
/****************************************************************
16
*			FILE reading test			*
16
*			FILE reading test			*
17
*****************************************************************/
17
*****************************************************************/
18
$conf_files=array(CONF_FILE);
18
$conf_files=array(CONF_FILE);
19
foreach ($conf_files as $file){
19
foreach ($conf_files as $file){
20
	if (!file_exists($file)){
20
	if (!file_exists($file)){
21
		exit("File ".$file." unknown");
21
		exit("File ".$file." unknown");
22
	}
22
	}
23
	if (!is_readable($file)){
23
	if (!is_readable($file)){
24
		exit("You don't have read rights on the file ".$file);
24
		exit("You don't have read rights on the file ".$file);
25
	}
25
	}
26
}
26
}
27
/****************************************************************
27
/****************************************************************
28
*			Read CONF_FILE				*
28
*			Read CONF_FILE				*
29
*****************************************************************/
29
*****************************************************************/
30
$ouvre=fopen(CONF_FILE,"r");
30
$ouvre=fopen(CONF_FILE,"r");
31
if ($ouvre){
31
if ($ouvre){
32
	while (!feof ($ouvre))
32
	while (!feof ($ouvre))
33
	{
33
	{
34
		$tampon = fgets($ouvre, 4096);
34
		$tampon = fgets($ouvre, 4096);
35
		if (strpos($tampon,"=")!==false){
35
		if (strpos($tampon,"=")!==false){
36
			$tmp = explode("=",$tampon);
36
			$tmp = explode("=",$tampon);
37
			$conf[$tmp[0]] = $tmp[1];
37
			$conf[$tmp[0]] = $tmp[1];
38
		}
38
		}
39
	}
39
	}
40
}else{
40
}else{
41
	exit("Error opening the file ".CONF_FILE);
41
	exit("Error opening the file ".CONF_FILE);
42
}
42
}
43
fclose($ouvre);
43
fclose($ouvre);
44
$organisme = trim($conf["ORGANISM"]);
44
$organisme = trim($conf["ORGANISM"]);
45
$domainname = trim($conf["DOMAIN"]);
45
$domainname = trim($conf["DOMAIN"]);
46
$hostname = "alcasar.".$domainname;
46
$hostname = "alcasar.".$domainname;
47
$network_pb = False;
47
$network_pb = False;
48
$cert_add = "http://$hostname/certs";
48
$cert_add = "http://$hostname/certs";
49
$direct_access = False;
49
$direct_access = False;
50
$display_menu=False;
50
$display_menu=False;
51
$diagnostic = "can't contact the default router";
51
$diagnostic = "can't contact the default router";
52
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "";
52
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "";
53
$tab = array();$user = array();
53
$tab = array();$user = array();
54
$connection_history =  "";
54
$connection_history =  "";
55
$nb_connection_history = 3;
55
$nb_connection_history = 3;
56
$Language = 'en';
56
$Language = 'en';
57
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
57
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
58
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
58
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
59
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
59
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
60
$redirect_link = "www.euronews.com"; # beware !!! HTTP only
60
$redirect_link = "www.euronews.com"; # Default redirection for HTTPS interception (beware, this website must run in HTTP)
61
 
61
 
62
# Retrieve the user info behind the remote ip
62
# Retrieve the user info behind the remote ip
63
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
63
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
64
$user = explode (" ", $tab[0]);
64
$user = explode (" ", $tab[0]);
65
 
65
 
66
 
66
 
67
# Test if it's a direct connexion to ALCASAR
67
# Test if it's a direct connexion to ALCASAR
68
if (isset($_SERVER['HTTP_HOST']))
68
if (isset($_SERVER['HTTP_HOST']))
69
{
69
{
70
	if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || (preg_match ("/^alcasar$/", $_SERVER['HTTP_HOST'])) || (preg_match ("/^$hostname$/", $_SERVER['HTTP_HOST'])) || (preg_match ("/^$organisme$/", $_SERVER['HTTP_HOST'])))
70
	if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || (preg_match ("/^alcasar$/", $_SERVER['HTTP_HOST'])) || (preg_match ("/^$hostname$/", $_SERVER['HTTP_HOST'])) || (preg_match ("/^$organisme$/", $_SERVER['HTTP_HOST'])))
71
	{	
71
	{	
72
	$direct_access=True;
72
	$direct_access=True;
73
	exec("sudo /usr/sbin/ipset del not_auth_yet $remote_ip"); # del user of the ipset "not_auth_yet" to not loop
73
	exec("sudo /usr/sbin/ipset del not_auth_yet $remote_ip"); # del user of the ipset "not_auth_yet" to not loop
74
	}
74
	}
75
}
75
}
76
# Function to adapt time connexion in seconds to H,M,S
76
# Function to adapt time connexion in seconds to H,M,S
77
function secondsToDuration($seconds = null){
77
function secondsToDuration($seconds = null){
78
	if ($seconds == null) return "";
78
	if ($seconds == null) return "";
79
	$temp = $seconds % 3600;
79
	$temp = $seconds % 3600;
80
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
80
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
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 the user is connected : retrieve the 3 last connexions
86
# If the user is connected : retrieve the 3 last connexions
87
if ((isset ($user[4])) && ($user[4] != "0")){
87
if ((isset ($user[4])) && ($user[4] != "0")){
88
	if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
88
	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");
89
		include_once("/etc/freeradius-web/config.php");
90
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
90
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
91
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
91
		$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
92
		$link = @da_sql_pconnect($config); // on affiche pas les erreurs
93
		if ($link){
93
		if ($link){
94
			$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
94
			$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
95
			
95
			
96
			if ($res){
96
			if ($res){
97
				$connection_history.= "<ul>";
97
				$connection_history.= "<ul>";
98
				while(($row = @da_sql_fetch_array($res,$config))){
98
				while(($row = @da_sql_fetch_array($res,$config))){
99
					$connected = "";
99
					$connected = "";
100
					if ($row['acctstoptime'] == "") $connected = " (active)";
100
					if ($row['acctstoptime'] == "") $connected = " (active)";
101
					$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row['acctsessiontime']).")'>$row[acctstarttime] (".secondsToDuration($row['acctsessiontime']).") $connected</li>";
101
					$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row['acctsessiontime']).")'>$row[acctstarttime] (".secondsToDuration($row['acctsessiontime']).") $connected</li>";
102
				}
102
				}
103
				$connection_history.="</ul>";
103
				$connection_history.="</ul>";
104
			}
104
			}
105
		}
105
		}
106
	}
106
	}
107
}
107
}
108
else # user not connected
108
else # user not connected
109
{
109
{
110
	exec("sudo /usr/sbin/ipset list not_auth_yet | grep $remote_ip | wc -l 2>&1", $ipset_not_auth_yet);
110
	exec("sudo /usr/sbin/ipset list not_auth_yet | grep $remote_ip | wc -l 2>&1", $ipset_not_auth_yet);
111
	if(!$direct_access && $ipset_not_auth_yet[0] == '0') # it's the fist stage of an interception 
111
	if(!$direct_access && $ipset_not_auth_yet[0] == '0') # it's the first stage of the interception 
112
	{
112
	{
113
		$display_menu = True; # Display menu for user not_auth_yet
113
		$display_menu = True; # Display menu for user not_auth_yet
-
 
114
		if (!isset($_SERVER['HTTPS'])) # In HTTP, the user is redirected on it's home page. In HTTPS, it's on the default page
-
 
115
		{
114
		$redirect_link = $_SERVER['HTTP_HOST']; # to keep the user URL
116
			$redirect_link = $_SERVER['HTTP_HOST']; # to keep the user URL
-
 
117
		}
-
 
118
 
115
	}
119
	}
116
	if(isset($_GET['url'])) # it's the second stage (when user has clicked to open a connection ...)
120
	if(isset($_GET['url'])) # it's the second stage (when user has clicked to open a connection ...)
117
	{
121
	{
118
		exec("sudo /usr/sbin/ipset add not_auth_yet $remote_ip"); # Add user in the ipset "not_auth_yet" (DNS requests not intercepted)
122
		exec("sudo /usr/sbin/ipset add not_auth_yet $remote_ip"); # Add user in the ipset "not_auth_yet" (DNS requests not intercepted)
119
		if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'off') # in HTTP, the user is redirected on it's home page (in HTiTPS, it's on the default page)
-
 
120
		{
-
 
121
			$redirect_link = "http://".$_GET['url'];
123
		$redir = "http://".$_GET['url'];  
122
		}
-
 
123
		else
-
 
124
		{
-
 
125
			$redirect_link = "http://".$redirect_link;
-
 
126
		}
-
 
127
		header("Location: $redirect_link",TRUE,307);
124
		header("Location: $redir",TRUE,307);
128
		exit; 
125
		exit; 
129
	}
126
	}
130
	if ($ipset_not_auth_yet[0] == '1'){ #if user not_auth_yet still here (index.php), we force DNS resquest.
127
	if ($ipset_not_auth_yet[0] == '1'){ #if user not_auth_yet still here (index.php), we force DNS resquest.
131
		 echo "<script>window.location.reload(true)</script>"; # force DNS request
128
		 echo "<script>window.location.reload(true)</script>"; # force DNS request
132
	}	
129
	}	
133
}
130
}
134
# Choice of language
131
# Choice of language
135
if($Language == 'fr'){
132
if($Language == 'fr'){
136
  $l_access_denied = "Contrôle d'accès";
133
  $l_access_denied = "Contrôle d'accès";
137
  $l_access_welcome = "Bienvenue sur ALCASAR";
134
  $l_access_welcome = "Bienvenue sur ALCASAR";
138
  $l_access_unavailable = "ACC&Egrave;S INDISPONIBLE";
135
  $l_access_unavailable = "ACC&Egrave;S INDISPONIBLE";
139
  $l_required_domain = "Site WEB demand&eacute;";
136
  $l_required_domain = "Site WEB demand&eacute;";
140
  $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.";
137
  $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.";
141
  $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.";
138
  $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.";
142
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
139
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
143
  $l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
140
  $l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
144
  $l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
141
  $l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
145
  $l_welcome = "Page principale de votre portail captif";
142
  $l_welcome = "Page principale de votre portail captif";
146
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Enregistrement par SMS</a>";
143
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Enregistrement par SMS</a>";
147
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installer le certificat racine</a>";
144
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installer le certificat racine</a>";
148
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installation du certificat de l'autorit&eacute; racine d'ALCASAR</a>";
145
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installation du certificat de l'autorit&eacute; racine d'ALCASAR</a>";
149
  $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>";
146
  $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>";
150
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
147
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
151
  $l_category = "catégorie :";
148
  $l_category = "catégorie :";
152
if ((isset ($user[4])) && ($user[4] == "0")) {
149
if ((isset ($user[4])) && ($user[4] == "0")) {
153
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
150
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
154
	  $l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Ouvrir une session Internet</a>";
151
	  $l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Ouvrir une session Internet</a>";
155
	}
152
	}
156
  else {
153
  else {
157
	  if ($user[5] != $user[0]) // authentication exception or not
154
	  if ($user[5] != $user[0]) // authentication exception or not
158
	  {
155
	  {
159
	  	$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";
156
	  	$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";
160
		$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</a>";
157
		$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</a>";
161
	  }
158
	  }
162
	  else
159
	  else
163
	  {
160
	  {
164
		  $l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history last connections :$connection_history";
161
		  $l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history last connections :$connection_history";
165
		  $l_logout = "Information des connexions";
162
		  $l_logout = "Information des connexions";
166
	  }
163
	  }
167
	}
164
	}
168
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
165
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
169
  $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.";
166
  $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.";
170
  $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";
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";
171
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
168
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
172
  $l_service_sms = "Service SMS actif";
169
  $l_service_sms = "Service SMS actif";
173
  $l_service_sms_n = "Service SMS non actif";
170
  $l_service_sms_n = "Service SMS non actif";
174
  $l_acc_sms = "Auto enregistrement par SMS";
171
  $l_acc_sms = "Auto enregistrement par SMS";
175
}
172
}
176
else if($Language == 'pt'){
173
else if($Language == 'pt'){
177
  $l_access_denied = "Controle de acesso";
174
  $l_access_denied = "Controle de acesso";
178
  $l_access_welcome = "Bem-vindo ao Alcasar";
175
  $l_access_welcome = "Bem-vindo ao Alcasar";
179
  $l_access_unavailable = "ACESSO INDISPONÍVEL";
176
  $l_access_unavailable = "ACESSO INDISPONÍVEL";
180
  $l_required_domain = "Site WEB Obrigatório";
177
  $l_required_domain = "Site WEB Obrigatório";
181
  $l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
178
  $l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
182
  $l_explain_access_deny = "Você tenta se conectar a um recurso cujo conteúdo é considerado inadequado no conteúdo de informações.";
179
  $l_explain_access_deny = "Você tenta se conectar a um recurso cujo conteúdo é considerado inadequado no conteúdo de informações.";
183
  $l_explain_net_pb = "O sistema detectou que o acesso é de risco, não será permitido o acesso";
180
  $l_explain_net_pb = "O sistema detectou que o acesso é de risco, não será permitido o acesso";
184
  $l_contact_access_deny = "Entre em contato com o administrador do sistema de segurança se acha que essa filtragem é abusiva.";
181
  $l_contact_access_deny = "Entre em contato com o administrador do sistema de segurança se acha que essa filtragem é abusiva.";
185
  $l_contact_net_pb = "Entre em contato com a empresa fornecedora de Internet para mais informações";
182
  $l_contact_net_pb = "Entre em contato com a empresa fornecedora de Internet para mais informações";
186
  $l_welcome = "Página do portal";
183
  $l_welcome = "Página do portal";
187
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
184
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
188
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
185
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
189
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
186
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
190
  $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>";
187
  $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>";
191
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
188
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
192
  $l_category = "categoria :";
189
  $l_category = "categoria :";
193
if ((isset ($user[4])) && ($user[4] == "0")) {
190
if ((isset ($user[4])) && ($user[4] == "0")) {
194
	$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
191
	$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
195
	$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
192
	$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
196
	}
193
	}
197
  else {
194
  else {
198
	  if ($user[5] != $user[0]) // authentication exception or not
195
	  if ($user[5] != $user[0]) // authentication exception or not
199
	  {
196
	  {
200
		  $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";
197
		  $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";
201
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
198
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
202
	  }
199
	  }
203
	  else
200
	  else
204
	  {
201
	  {
205
		  $l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
202
		  $l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
206
		  $l_logout = "Informações de conexões";
203
		  $l_logout = "Informações de conexões";
207
	  }
204
	  }
208
  	}
205
  	}
209
  $l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
206
  $l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
210
  $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.";
207
  $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.";
211
  $l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
208
  $l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
212
  $l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
209
  $l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
213
  $l_service_sms = "SMS service enable";
210
  $l_service_sms = "SMS service enable";
214
  $l_service_sms_n = "SMS service disable";
211
  $l_service_sms_n = "SMS service disable";
215
  $l_acc_sms = "Auto registration by SMS";
212
  $l_acc_sms = "Auto registration by SMS";
216
}
213
}
217
else {
214
else {
218
  $l_access_denied = "Access control";
215
  $l_access_denied = "Access control";
219
  $l_access_welcome = "Welcome on ALCASAR";
216
  $l_access_welcome = "Welcome on ALCASAR";
220
  $l_access_unavailable = "ACCESS UNAVAILABLE";
217
  $l_access_unavailable = "ACCESS UNAVAILABLE";
221
  $l_required_domain = "Required WEB site";
218
  $l_required_domain = "Required WEB site";
222
  $l_explain_acc_access = "This center control the portal. You must have an administrative account.";
219
  $l_explain_acc_access = "This center control the portal. You must have an administrative account.";
223
  $l_explain_access_deny = "You try to connect to a resource whose content is deemed to contain inappropriate information.";
220
  $l_explain_access_deny = "You try to connect to a resource whose content is deemed to contain inappropriate information.";
224
  $l_explain_net_pb = "Your portal has just detected that the Internet access is down";
221
  $l_explain_net_pb = "Your portal has just detected that the Internet access is down";
225
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
222
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
226
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
223
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
227
  $l_welcome = "Your captive portal main page";
224
  $l_welcome = "Your captive portal main page";
228
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
225
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
229
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
226
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
230
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
227
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
231
  $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>";
228
  $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>";
232
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
229
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
233
  $l_category = "category :";
230
  $l_category = "category :";
234
if ((isset ($user[4])) && ($user[4] == "0")) {
231
if ((isset ($user[4])) && ($user[4] == "0")) {
235
	$l_logout_explain = "No Internet consultation session is actualy open on your system";
232
	$l_logout_explain = "No Internet consultation session is actualy open on your system";
236
	$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Open an Internet session</a>";
233
	$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Open an Internet session</a>";
237
	}
234
	}
238
  else {
235
  else {
239
	  if ($user[5] != $user[0]) // authentication exception or not
236
	  if ($user[5] != $user[0]) // authentication exception or not
240
	  {
237
	  {
241
		  $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";
238
		  $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";
242
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
239
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
243
	  }
240
	  }
244
	  else
241
	  else
245
	  {
242
	  {
246
		  $l_logout_explain = "Your system ($user[5]) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
243
		  $l_logout_explain = "Your system ($user[5]) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
247
		  $l_logout = "Connections information";
244
		  $l_logout = "Connections information";
248
	  }
245
	  }
249
  	}
246
  	}
250
  $l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
247
  $l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
251
  $l_password_change_explain = "Redirect you on password change page.<br><br> You should already have an Internet access account.";
248
  $l_password_change_explain = "Redirect you on password change page.<br><br> You should already have an Internet access account.";
252
  $l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
249
  $l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
253
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
250
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
254
  $l_service_sms = "SMS service enable";
251
  $l_service_sms = "SMS service enable";
255
  $l_service_sms_n = "SMS service disable";
252
  $l_service_sms_n = "SMS service disable";
256
  $l_acc_sms = "Auto registration by SMS";
253
  $l_acc_sms = "Auto registration by SMS";
257
}
254
}
258
 
255
 
259
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
256
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
260
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
257
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
261
 
258
 
262
# set the icons
259
# set the icons
263
$img_rep = "./images/";
260
$img_rep = "/images/";
264
$img_organisme = "organisme.png";
261
$img_organisme = "organisme.png";
265
$img_access = "globe_acces_70.png";
262
$img_access = "globe_acces_70.png";
266
$img_connect = "globe_70.png";
263
$img_connect = "globe_70.png";
267
$img_warning = "globe_warning_70.png";
264
$img_warning = "globe_warning_70.png";
268
$img_pwd = "cle_ombre.png";
265
$img_pwd = "cle_ombre.png";
269
$img_certificate = "certificat.png";
266
$img_certificate = "certificat.png";
270
$img_acc = "logo-alcasar_70.png";
267
$img_acc = "logo-alcasar_70.png";
271
$img_sms = "sms.png";
268
$img_sms = "sms.png";
272
$img_false = "interdit.png";
269
$img_false = "interdit.png";
273
$img_adm = "adm.png";
270
$img_adm = "adm.png";
274
$img_internet = $img_connect;
271
$img_internet = $img_connect;
275
 
272
 
276
if ((isset ($user[4])) && ($user[4] == "0")) {
273
if ((isset ($user[4])) && ($user[4] == "0")) {
277
	if (! $network_pb) {
274
	if (! $network_pb) {
278
		$img_internet = $img_access;
275
		$img_internet = $img_access;
279
		}
276
		}
280
		else {
277
		else {
281
		$img_internet = $img_warning;
278
		$img_internet = $img_warning;
282
	}
279
	}
283
}
280
}
284
else {
281
else {
285
	$img_internet = $img_connect;
282
	$img_internet = $img_connect;
286
}
283
}
287
 
284
 
288
# cleaning the cache
285
# cleaning the cache
289
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
286
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
290
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
287
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
291
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
288
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
292
header("Cache-Control: post-check=0, pre-check=0", false);
289
header("Cache-Control: post-check=0, pre-check=0", false);
293
header("Pragma: no-cache");
290
header("Pragma: no-cache");
294
?>
291
?>
295
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
292
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
296
	<html>
293
	<html>
297
	<head>
294
	<head>
298
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
295
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
299
	<title>ALCASAR - <?php echo $l_title; ?></title>
296
	<title>ALCASAR - <?php echo $l_title; ?></title>
300
	<meta http-equiv="Cache-control" content="no-cache">
297
	<meta http-equiv="Cache-control" content="no-cache">
301
	<meta http-equiv="Pragma" content="no-cache">
298
	<meta http-equiv="Pragma" content="no-cache">
302
<?php
299
<?php
303
	echo "<style>";
300
	echo "<style>";
304
	include("css/style_intercept.css");
301
	include("css/style_intercept.css");
305
	echo "</style>";
302
	echo "</style>";
306
?>
303
?>
307
<script type="text/javascript">
304
<script type="text/javascript">
308
	function valoriserDiv5(param){
305
	function valoriserDiv5(param){
309
		document.getElementById("box_info").innerHTML = param.innerHTML;
306
		document.getElementById("box_info").innerHTML = param.innerHTML;
310
	}
307
	}
311
</script>
308
</script>
312
</head>
309
</head>
313
<body onload="valoriserDiv5(text_conn);">
310
<body onload="valoriserDiv5(text_conn);">
314
<?php
311
<?php
315
if ($direct_access || $display_menu){
312
if ($direct_access || $display_menu){
316
	echo "
313
	echo "
317
		<div id=\"cadre_titre\" class=\"titre_controle\">
314
		<div id=\"cadre_titre\" class=\"titre_controle\">
318
			<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
315
			<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
319
	if ($network_pb) {
316
	if ($network_pb) {
320
		echo "	<span>$l_explain_net_pb</span>";
317
		echo "	<span>$l_explain_net_pb</span>";
321
		}
318
		}
322
	}
319
	}
323
	else {
320
	else {
324
		echo"
321
		echo"
325
			<div id=\"cadre_titre\" class=\"titre_refus\">
322
			<div id=\"cadre_titre\" class=\"titre_refus\">
326
				<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
323
				<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
327
	}
324
	}
328
?>
325
?>
329
			<div id="boite_logo">
326
			<div id="boite_logo">
330
				<img src="<?php echo "$img_rep$img_organisme"; ?>">
327
				<img src="<?php echo "$img_rep$img_organisme"; ?>">
331
			</div>
328
			</div>
332
		</div>
329
		</div>
333
		<div id="contenu_acces">
330
		<div id="contenu_acces">
334
			<div id="box_url">
331
			<div id="box_url">
335
<?php 
332
<?php 
336
# search here in the blacklist categories if we want to display it (if ((! $direct_access) && (! $network_pb)){}
333
# search here in the blacklist categories if we want to display it (if ((! $direct_access) && (! $network_pb)){}
337
?>
334
?>
338
			</div>
335
			</div>
339
<?php
336
<?php
340
# Check if the SMS service is enable
337
# Check if the SMS service is enable
341
$service_SMS_status="false";
338
$service_SMS_status="false";
342
if ($service_SMS_status == "true") {
339
if ($service_SMS_status == "true") {
343
$sms_div='	
340
$sms_div='	
344
			<div class="box_menu" id="box_acc" onmouseover="valoriserDiv5(text_acc);">
341
			<div class="box_menu" id="box_acc" onmouseover="valoriserDiv5(text_acc);">
345
				<span>'.$l_sms_access.'</span>
342
				<span>'.$l_sms_access.'</span>
346
				<img src="'.$img_rep.''.$img_sms.'">
343
				<img src="'.$img_rep.''.$img_sms.'">
347
			</div>
344
			</div>
348
';
345
';
349
 
346
 
350
$sms_div_over='			
347
$sms_div_over='			
351
			<div class="div-cache" id="text_acc">
348
			<div class="div-cache" id="text_acc">
352
				<h2>'.$l_sms_access.'</h2>
349
				<h2>'.$l_sms_access.'</h2>
353
				<p>'.$l_sms_explain.'</p>
350
				<p>'.$l_sms_explain.'</p>
354
				<p><font color="green"><center>'.$l_service_sms.'</center></font></p>
351
				<p><font color="green"><center>'.$l_service_sms.'</center></font></p>
355
				<img src="'.$img_rep.''.$img_sms.'">
352
				<img src="'.$img_rep.''.$img_sms.'">
356
			</div>
353
			</div>
357
';
354
';
358
}
355
}
359
else {
356
else {
360
$sms_div='';
357
$sms_div='';
361
$sms_div_over='';
358
$sms_div_over='';
362
}
359
}
363
?>
360
?>
364
<?php
361
<?php
365
if ($direct_access || $display_menu){
362
if ($direct_access || $display_menu){
366
	echo "	<div id=\"box_bienvenue\">
363
	echo "	<div id=\"box_bienvenue\">
367
				$l_welcome
364
				$l_welcome
368
			</div>
365
			</div>
369
			<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
366
			<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
370
				<span>$l_logout</span>
367
				<span>$l_logout</span>
371
				<img src=\"$img_rep$img_internet\">
368
				<img src=\"$img_rep$img_internet\">
372
			</div>
369
			</div>
373
			<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
370
			<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
374
				<span>$l_install_certif</span>
371
				<span>$l_install_certif</span>
375
				<img src=\"$img_rep$img_certificate\">
372
				<img src=\"$img_rep$img_certificate\">
376
			</div>
373
			</div>
377
			<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
374
			<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
378
				<img src=\"$img_rep$img_pwd\">
375
				<img src=\"$img_rep$img_pwd\">
379
				<span>$l_password_change</span>
376
				<span>$l_password_change</span>
380
			</div>		
377
			</div>		
381
			$sms_div
378
			$sms_div
382
			<div class=\"div-cache\" id=\"text_conn\">
379
			<div class=\"div-cache\" id=\"text_conn\">
383
				<h2>$l_logout</h2>
380
				<h2>$l_logout</h2>
384
				<p>$l_logout_explain</p>
381
				<p>$l_logout_explain</p>
385
				<img src=\"$img_rep$img_internet\">
382
				<img src=\"$img_rep$img_internet\">
386
			</div>
383
			</div>
387
			<div class=\"div-cache\" id=\"text_certif\">
384
			<div class=\"div-cache\" id=\"text_certif\">
388
				<h2>$l_install_certif_more</h2>
385
				<h2>$l_install_certif_more</h2>
389
				<p>$l_certif_explain $l_certif_explain_help</p>
386
				<p>$l_certif_explain $l_certif_explain_help</p>
390
				<img src=\"$img_rep$img_certificate\">				
387
				<img src=\"$img_rep$img_certificate\">				
391
			</div>
388
			</div>
392
			<div class=\"div-cache\" id=\"text_mdp\">
389
			<div class=\"div-cache\" id=\"text_mdp\">
393
				<h2>$l_password_change</h2>
390
				<h2>$l_password_change</h2>
394
				<p>$l_password_change_explain</p>
391
				<p>$l_password_change_explain</p>
395
				<img src=\"$img_rep$img_pwd\">
392
				<img src=\"$img_rep$img_pwd\">
396
			</div>
393
			</div>
397
			$sms_div_over
394
			$sms_div_over
398
			<div id=\"box_info\">
395
			<div id=\"box_info\">
399
			</div>";
396
			</div>";
400
	}
397
	}
401
else {
398
else {
402
		echo "
399
		echo "
403
			<div id=\"box_refuse\">
400
			<div id=\"box_refuse\">
404
				<img src=\"$img_rep$img_false\">
401
				<img src=\"$img_rep$img_false\">
405
				<p>$l_explain</p>
402
				<p>$l_explain</p>
406
			</div>
403
			</div>
407
			<div id=\"liens_redir\">
404
			<div id=\"liens_redir\">
408
				<p>$l_back_page</p>
405
				<p>$l_back_page</p>
409
			</div>";
406
			</div>";
410
		}
407
		}
411
	if (($network_pb)&&(! $direct_access)) {
408
	if (($network_pb)&&(! $direct_access)) {
412
	echo "	<span>Diagnostic : $diagnostic</span>";
409
	echo "	<span>Diagnostic : $diagnostic</span>";
413
	}
410
	}
414
?>
411
?>
415
		</div>
412
		</div>
416
		<div id="corner">
413
		<div id="corner">
417
			<div id="adm" class="corn">
414
			<div id="adm" class="corn">
418
				<a href="https://<?php echo $hostname; ?>/acc/"><img src=<?php echo $img_rep.''.$img_adm; ?>></a>
415
				<a href="https://<?php echo $hostname; ?>/acc/"><img src=<?php echo $img_rep.''.$img_adm; ?>></a>
419
			</div>
416
			</div>
420
		</div>
417
		</div>
421
	</body>
418
	</body>
422
</html>
419
</html>
423
 
420
 
424
 
421
 
425
 
422