Subversion Repositories ALCASAR

Rev

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

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