Subversion Repositories ALCASAR

Rev

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

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