Subversion Repositories ALCASAR

Rev

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

Rev 1867 Rev 1878
1
<?php
1
<?php
2
# $Id: index.php 1867 2016-05-04 12:22:08Z raphael.pion $
2
# $Id: index.php 1878 2016-05-09 13:09:13Z raphael.pion $
3
#
3
#
4
# index.php for ALCASAR captive portal
4
# index.php for ALCASAR captive portal
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
# Obtenir l'état de connexion de l'utilisateur. 1 si connecté sinon 0.
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
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
61
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
62
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']))
62
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'])))
63
	{
63
	{
64
	$direct_access=True;
64
	$direct_access=True;
65
	}
65
	}
66
#### Affichage des 3 dernières connexions de $user[5]
66
#### Affichage des 3 dernières connexions de $user[5]
67
function secondsToDuration($seconds = null){
67
function secondsToDuration($seconds = null){
68
	if ($seconds == null) return "";
68
	if ($seconds == null) return "";
69
 
69
 
70
	$temp = $seconds % 3600;
70
	$temp = $seconds % 3600;
71
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
71
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
72
	$time[2] = $temp % 60 ;				// seconds
72
	$time[2] = $temp % 60 ;				// seconds
73
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
73
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
74
	
74
	
75
	return $time[0]." h ".$time[1]." m ".$time[2]." s";
75
	return $time[0]." h ".$time[1]." m ".$time[2]." s";
76
}
76
}
77
 
77
 
78
$l_connected = "connected"; // a traduire (choix de la langue ci-dessous mais nécessitant de $connection_history)
78
$l_connected = "connected"; // a traduire (choix de la langue ci-dessous mais nécessitant de $connection_history)
79
// si on a pas d'accès à la bdd, la page s'affiche quand même correctement
79
// si on a pas d'accès à la bdd, la page s'affiche quand même correctement
80
if ((isset ($user[4])) && ($user[4] != "0")){
80
if ((isset ($user[4])) && ($user[4] != "0")){
81
	if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
81
	if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
82
		include_once("/etc/freeradius-web/config.php");
82
		include_once("/etc/freeradius-web/config.php");
83
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
83
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
84
		
84
		
85
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
85
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
86
		$link = @da_sql_pconnect($config); // on affiche pas les erreurs
86
		$link = @da_sql_pconnect($config); // on affiche pas les erreurs
87
		
87
		
88
		if ($link){
88
		if ($link){
89
			$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
89
			$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
90
			
90
			
91
			if ($res){
91
			if ($res){
92
				$connection_history.= "<ul>";
92
				$connection_history.= "<ul>";
93
				while(($row = @da_sql_fetch_array($res,$config))){
93
				while(($row = @da_sql_fetch_array($res,$config))){
94
					$connected = "";
94
					$connected = "";
95
					if ($row['acctstoptime'] == "") $connected = " ($l_connected)";
95
					if ($row['acctstoptime'] == "") $connected = " ($l_connected)";
96
					$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row['acctsessiontime']).")'>$row[acctstarttime] (".secondsToDuration($row['acctsessiontime']).") $connected</li>";
96
					$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row['acctsessiontime']).")'>$row[acctstarttime] (".secondsToDuration($row['acctsessiontime']).") $connected</li>";
97
				}
97
				}
98
				$connection_history.="</ul>";
98
				$connection_history.="</ul>";
99
			}
99
			}
100
		}
100
		}
101
	}
101
	}
102
}
102
}
103
else
103
else
104
{
104
{
105
	# cas où l'utilisateur non-loggué décide de joindre une page HTTP/S => redirection http://URL
105
	# cas où l'utilisateur non-loggué décide de joindre une page HTTP/S => redirection http://URL
106
	# 							   																					 ALCASAR => redirection index.php
106
	# 							   																					 ALCASAR => redirection index.php
107
	# on place l'IP de l'utilisateur dans un ipset not_auth_yet pour ne pas boucler
107
	# on place l'IP de l'utilisateur dans un ipset not_auth_yet pour ne pas boucler
108
	exec("sudo /usr/sbin/ipset add not_auth_yet $remote_ip");
108
	exec("sudo /usr/sbin/ipset add not_auth_yet $remote_ip");
109
	if(!$direct_access)
109
	if(!$direct_access)
110
	{
110
	{
111
		header("Cache-Control: no-cache, must-revalidate");
111
		header("Cache-Control: no-cache, must-revalidate");
112
		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
112
		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
113
		header("Content-Type: application/xml; charset=utf-8");
113
		header("Content-Type: application/xml; charset=utf-8");
114
		header("Location: http://".$_SERVER['HTTP_HOST']);
114
		header("Location: http://".$_SERVER['HTTP_HOST']);
115
		exit;	
115
		exit;	
116
	}
116
	}
117
	
117
	
118
}
118
}
119
####
119
####
120
 
120
 
121
# Choice of language
121
# Choice of language
122
$Language = 'en';
122
$Language = 'en';
123
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
123
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
124
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
124
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
125
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
125
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
126
if($Language == 'fr'){
126
if($Language == 'fr'){
127
  $l_access_denied = "ACC&Egrave;S REFUS&Eacute;";
127
  $l_access_denied = "ACC&Egrave;S REFUS&Eacute;";
128
  $l_access_welcome = "Bienvenue sur ALCASAR";
128
  $l_access_welcome = "Bienvenue sur ALCASAR";
129
  $l_access_unavailable = "ACC&Egrave;S INDISPONIBLE";
129
  $l_access_unavailable = "ACC&Egrave;S INDISPONIBLE";
130
  $l_required_domain = "Site WEB demand&eacute;";
130
  $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.";
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.";
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.";
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.";
133
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
133
  $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.";
134
  $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.";
135
  $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";
136
  $l_welcome = "Page principale de votre portail captif";
137
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Enregistrement par SMS</a>";
137
  $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>";
138
  $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>";
139
  $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>";
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>";
141
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
141
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
142
  $l_category = "catégorie :";
142
  $l_category = "catégorie :";
143
if ((isset ($user[4])) && ($user[4] == "0")) {
143
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.";
144
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
145
	  $l_logout = "<a href=\"http://www.google.com\">Ouvrir une session Internet</a>";
145
	  $l_logout = "<a href=\"http://www.google.com\">Ouvrir une session Internet</a>";
146
	  
146
	  
147
 
147
 
148
	}
148
	}
149
  else {
149
  else {
150
	  if ($user[5] != $user[0]) // authentication exception or not
150
	  if ($user[5] != $user[0]) // authentication exception or not
151
	  {
151
	  {
152
	  	$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";
152
	  	$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 = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</a>";
153
		$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</a>";
154
	  }
154
	  }
155
	  else
155
	  else
156
	  {
156
	  {
157
		  $l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history last connections :$connection_history";
157
		  $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 = "Information des connexions";
158
		  $l_logout = "Information des connexions";
159
	  }
159
	  }
160
	}
160
	}
161
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
161
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
162
  $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.";
162
  $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_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";
163
  $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_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
164
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
165
  $l_service_sms = "Service SMS actif";
165
  $l_service_sms = "Service SMS actif";
166
  $l_service_sms_n = "Service SMS non actif";
166
  $l_service_sms_n = "Service SMS non actif";
167
  $l_acc_sms = "Auto enregistrement par SMS";
167
  $l_acc_sms = "Auto enregistrement par SMS";
168
}
168
}
169
else if($Language == 'pt'){
169
else if($Language == 'pt'){
170
  $l_access_denied = "Acesso negado";
170
  $l_access_denied = "Acesso negado";
171
  $l_access_welcome = "Bem-vindo ao Alcasar";
171
  $l_access_welcome = "Bem-vindo ao Alcasar";
172
  $l_access_unavailable = "ACESSO INDISPONÍVEL";
172
  $l_access_unavailable = "ACESSO INDISPONÍVEL";
173
  $l_required_domain = "Site WEB Obrigatório";
173
  $l_required_domain = "Site WEB Obrigatório";
174
  $l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
174
  $l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
175
  $l_explain_access_deny = "Você tenta se conectar a um recurso cujo conteúdo é considerado inadequado no conteúdo de informações.";
175
  $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_net_pb = "O sistema detectou que o acesso é de risco, não será permitido o acesso";
176
  $l_explain_net_pb = "O sistema detectou que o acesso é de risco, não será permitido o acesso";
177
  $l_contact_access_deny = "Entre em contato com o administrador do sistema de segurança se acha que essa filtragem é abusiva.";
177
  $l_contact_access_deny = "Entre em contato com o administrador do sistema de segurança se acha que essa filtragem é abusiva.";
178
  $l_contact_net_pb = "Entre em contato com a empresa fornecedora de Internet para mais informações";
178
  $l_contact_net_pb = "Entre em contato com a empresa fornecedora de Internet para mais informações";
179
  $l_welcome = "Página do portal";
179
  $l_welcome = "Página do portal";
180
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
180
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
181
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
181
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
182
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
182
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
183
  $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>";
183
  $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_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
184
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
185
  $l_category = "categoria :";
185
  $l_category = "categoria :";
186
if ((isset ($user[4])) && ($user[4] == "0")) {
186
if ((isset ($user[4])) && ($user[4] == "0")) {
187
	  $l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
187
	  $l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
188
	  $l_logout = "<a href=\"http://www.google.com\">Abrir uma conexão de Internet</a>";
188
	  $l_logout = "<a href=\"http://www.google.com\">Abrir uma conexão de Internet</a>";
189
	  
189
	  
190
 
190
 
191
	}
191
	}
192
  else {
192
  else {
193
	  if ($user[5] != $user[0]) // authentication exception or not
193
	  if ($user[5] != $user[0]) // authentication exception or not
194
	  {
194
	  {
195
		  $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";
195
		  $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 = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
196
		  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
197
	  }
197
	  }
198
	  else
198
	  else
199
	  {
199
	  {
200
		  $l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
200
		  $l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
201
		  $l_logout = "Informações de conexões";
201
		  $l_logout = "Informações de conexões";
202
	  }
202
	  }
203
  	}
203
  	}
204
  $l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
204
  $l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
205
  $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.";
205
  $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_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
206
  $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_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
207
  $l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
208
  $l_service_sms = "SMS service enable";
208
  $l_service_sms = "SMS service enable";
209
  $l_service_sms_n = "SMS service disable";
209
  $l_service_sms_n = "SMS service disable";
210
  $l_acc_sms = "Auto registration by SMS";
210
  $l_acc_sms = "Auto registration by SMS";
211
}
211
}
212
else {
212
else {
213
  $l_access_denied = "ACCESS DENIED";
213
  $l_access_denied = "ACCESS DENIED";
214
  $l_access_welcome = "Welcome on ALCASAR";
214
  $l_access_welcome = "Welcome on ALCASAR";
215
  $l_access_unavailable = "ACCESS UNAVAILABLE";
215
  $l_access_unavailable = "ACCESS UNAVAILABLE";
216
  $l_required_domain = "Required WEB site";
216
  $l_required_domain = "Required WEB site";
217
  $l_explain_acc_access = "This center control the portal. You must have an administrative account.";
217
  $l_explain_acc_access = "This center control the portal. You must have an administrative account.";
218
  $l_explain_access_deny = "You try to connect to a resource whose content is deemed to contain inappropriate information.";
218
  $l_explain_access_deny = "You try to connect to a resource whose content is deemed to contain inappropriate information.";
219
  $l_explain_net_pb = "Your portal has just detected that the Internet access is down";
219
  $l_explain_net_pb = "Your portal has just detected that the Internet access is down";
220
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
220
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
221
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
221
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
222
  $l_welcome = "Your captive portal main page";
222
  $l_welcome = "Your captive portal main page";
223
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
223
  $l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
224
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
224
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
225
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
225
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
226
  $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>";
226
  $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_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
227
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
228
  $l_category = "category :";
228
  $l_category = "category :";
229
if ((isset ($user[4])) && ($user[4] == "0")) {
229
if ((isset ($user[4])) && ($user[4] == "0")) {
230
	  $l_logout_explain = "No Internet consultation session is actualy open on your system";
230
	  $l_logout_explain = "No Internet consultation session is actualy open on your system";
231
		$l_logout = "<a href=\"http://www.google.com\">Open an Internet session</a>";
231
		$l_logout = "<a href=\"http://www.google.com\">Open an Internet session</a>";
232
	  
232
	  
233
 
233
 
234
	}
234
	}
235
  else {
235
  else {
236
	  if ($user[5] != $user[0]) // authentication exception or not
236
	  if ($user[5] != $user[0]) // authentication exception or not
237
	  {
237
	  {
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";
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";
239
		  $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>";
240
	  }
240
	  }
241
	  else
241
	  else
242
	  {
242
	  {
243
		  $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";
244
		  $l_logout = "Connections information";
244
		  $l_logout = "Connections information";
245
	  }
245
	  }
246
  	}
246
  	}
247
  $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>";
248
  $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.";
249
  $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";
250
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
250
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
251
  $l_service_sms = "SMS service enable";
251
  $l_service_sms = "SMS service enable";
252
  $l_service_sms_n = "SMS service disable";
252
  $l_service_sms_n = "SMS service disable";
253
  $l_acc_sms = "Auto registration by SMS";
253
  $l_acc_sms = "Auto registration by SMS";
254
}
254
}
255
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
255
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
256
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
256
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
257
 
257
 
258
# Attribution des icones / images
258
# Attribution des icones / images
259
$img_rep = "images/";
259
$img_rep = "images/";
260
$img_organisme = "organisme.png";
260
$img_organisme = "organisme.png";
261
$img_access = "globe_acces_70.png";
261
$img_access = "globe_acces_70.png";
262
$img_connect = "globe_70.png";
262
$img_connect = "globe_70.png";
263
$img_warning = "globe_warning_70.png";
263
$img_warning = "globe_warning_70.png";
264
$img_pwd = "cle_ombre.png";
264
$img_pwd = "cle_ombre.png";
265
$img_certificate = "certificat.png";
265
$img_certificate = "certificat.png";
266
$img_acc = "logo-alcasar_70.png";
266
$img_acc = "logo-alcasar_70.png";
267
$img_sms = "sms.png";
267
$img_sms = "sms.png";
268
$img_false = "interdit.png";
268
$img_false = "interdit.png";
269
$img_adm = "adm.png";
269
$img_adm = "adm.png";
270
$img_internet = $img_connect;
270
$img_internet = $img_connect;
271
 
271
 
272
if ((isset ($user[4])) && ($user[4] == "0")) {
272
if ((isset ($user[4])) && ($user[4] == "0")) {
273
	if (! $network_pb) {
273
	if (! $network_pb) {
274
		$img_internet = $img_access;
274
		$img_internet = $img_access;
275
		}
275
		}
276
		else {
276
		else {
277
		$img_internet = $img_warning;
277
		$img_internet = $img_warning;
278
	}
278
	}
279
}
279
}
280
else {
280
else {
281
	$img_internet = $img_connect;
281
	$img_internet = $img_connect;
282
}
282
}
283
 
283
 
284
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
284
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
285
?>
285
?>
286
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
286
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
287
	<html>
287
	<html>
288
	<head>
288
	<head>
289
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
289
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
290
	<title>ALCASAR - <?php echo $l_title; ?></title>
290
	<title>ALCASAR - <?php echo $l_title; ?></title>
291
	<meta http-equiv="Cache-control" content="no-cache">
291
	<meta http-equiv="Cache-control" content="no-cache">
292
	<meta http-equiv="Pragma" content="no-cache">
292
	<meta http-equiv="Pragma" content="no-cache">
293
	<link rel="stylesheet" type="text/css" href="css/style_intercept.css">
293
	<link rel="stylesheet" type="text/css" href="css/style_intercept.css">
294
	<script type="text/javascript">
294
	<script type="text/javascript">
295
		function valoriserDiv5(param){
295
		function valoriserDiv5(param){
296
			document.getElementById("box_info").innerHTML = param.innerHTML;
296
			document.getElementById("box_info").innerHTML = param.innerHTML;
297
		}
297
		}
298
	</script>
298
	</script>
299
</head>
299
</head>
300
<body onload="valoriserDiv5(text_conn);">
300
<body onload="valoriserDiv5(text_conn);">
301
<?php
301
<?php
302
if ($direct_access){
302
if ($direct_access){
303
	echo "
303
	echo "
304
		<div id=\"cadre_titre\" class=\"titre_controle\">
304
		<div id=\"cadre_titre\" class=\"titre_controle\">
305
			<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
305
			<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
306
	if ($network_pb) {
306
	if ($network_pb) {
307
		echo "	<span>$l_explain_net_pb</span>";
307
		echo "	<span>$l_explain_net_pb</span>";
308
		}
308
		}
309
	}
309
	}
310
	else {
310
	else {
311
		echo"
311
		echo"
312
			<div id=\"cadre_titre\" class=\"titre_refus\">
312
			<div id=\"cadre_titre\" class=\"titre_refus\">
313
				<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
313
				<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
314
	}
314
	}
315
?>
315
?>
316
			<div id="boite_logo">
316
			<div id="boite_logo">
317
				<img src="images/organisme.png">
317
				<img src="images/organisme.png">
318
			</div>
318
			</div>
319
		</div>
319
		</div>
320
		<div id="contenu_acces">
320
		<div id="contenu_acces">
321
			<div id="box_url">
321
			<div id="box_url">
322
<?php 
322
<?php 
323
//search here in the blacklist categories (if ((! $direct_access) && (! $network_pb)){}
323
//search here in the blacklist categories (if ((! $direct_access) && (! $network_pb)){}
324
?>
324
?>
325
			</div>
325
			</div>
326
<?php
326
<?php
327
# CHECK IF the SMS service is enable
327
# CHECK IF the SMS service is enable
328
$service_SMS_status="false";
328
$service_SMS_status="false";
329
if ($service_SMS_status == "true") {
329
if ($service_SMS_status == "true") {
330
$sms_div='	
330
$sms_div='	
331
			<div class="box_menu" id="box_acc" onmouseover="valoriserDiv5(text_acc);">
331
			<div class="box_menu" id="box_acc" onmouseover="valoriserDiv5(text_acc);">
332
				<span>'.$l_sms_access.'</span>
332
				<span>'.$l_sms_access.'</span>
333
				<img src="'.$img_rep.''.$img_sms.'">
333
				<img src="'.$img_rep.''.$img_sms.'">
334
			</div>
334
			</div>
335
';
335
';
336
 
336
 
337
$sms_div_over='			
337
$sms_div_over='			
338
			<div class="div-cache" id="text_acc">
338
			<div class="div-cache" id="text_acc">
339
				<h2>'.$l_sms_access.'</h2>
339
				<h2>'.$l_sms_access.'</h2>
340
				<p>'.$l_sms_explain.'</p>
340
				<p>'.$l_sms_explain.'</p>
341
				<p><font color="green"><center>'.$l_service_sms.'</center></font></p>
341
				<p><font color="green"><center>'.$l_service_sms.'</center></font></p>
342
				<img src="'.$img_rep.''.$img_sms.'">
342
				<img src="'.$img_rep.''.$img_sms.'">
343
			</div>
343
			</div>
344
';
344
';
345
}
345
}
346
else {
346
else {
347
$sms_div='';
347
$sms_div='';
348
$sms_div_over='';
348
$sms_div_over='';
349
}
349
}
350
?>
350
?>
351
<?php
351
<?php
352
if ($direct_access){
352
if ($direct_access){
353
	echo "	<div id=\"box_bienvenue\">
353
	echo "	<div id=\"box_bienvenue\">
354
				$l_welcome
354
				$l_welcome
355
			</div>
355
			</div>
356
			<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
356
			<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
357
				<span>$l_logout</span>
357
				<span>$l_logout</span>
358
				<img src=\"$img_rep$img_internet\">
358
				<img src=\"$img_rep$img_internet\">
359
			</div>
359
			</div>
360
			<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
360
			<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
361
				<span>$l_install_certif</span>
361
				<span>$l_install_certif</span>
362
				<img src=\"$img_rep$img_certificate\">
362
				<img src=\"$img_rep$img_certificate\">
363
			</div>
363
			</div>
364
			<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
364
			<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
365
				<img src=\"$img_rep$img_pwd\">
365
				<img src=\"$img_rep$img_pwd\">
366
				<span>$l_password_change</span>
366
				<span>$l_password_change</span>
367
			</div>		
367
			</div>		
368
			$sms_div
368
			$sms_div
369
			<div class=\"div-cache\" id=\"text_conn\">
369
			<div class=\"div-cache\" id=\"text_conn\">
370
				<h2>$l_logout</h2>
370
				<h2>$l_logout</h2>
371
				<p>$l_logout_explain</p>
371
				<p>$l_logout_explain</p>
372
				<img src=\"$img_rep$img_internet\">
372
				<img src=\"$img_rep$img_internet\">
373
			</div>
373
			</div>
374
			<div class=\"div-cache\" id=\"text_certif\">
374
			<div class=\"div-cache\" id=\"text_certif\">
375
				<h2>$l_install_certif_more</h2>
375
				<h2>$l_install_certif_more</h2>
376
				<p>$l_certif_explain $l_certif_explain_help</p>
376
				<p>$l_certif_explain $l_certif_explain_help</p>
377
				<img src=\"$img_rep$img_certificate\">				
377
				<img src=\"$img_rep$img_certificate\">				
378
			</div>
378
			</div>
379
			<div class=\"div-cache\" id=\"text_mdp\">
379
			<div class=\"div-cache\" id=\"text_mdp\">
380
				<h2>$l_password_change</h2>
380
				<h2>$l_password_change</h2>
381
				<p>$l_password_change_explain</p>
381
				<p>$l_password_change_explain</p>
382
				<img src=\"$img_rep$img_pwd\">
382
				<img src=\"$img_rep$img_pwd\">
383
			</div>
383
			</div>
384
			$sms_div_over
384
			$sms_div_over
385
			<div id=\"box_info\">
385
			<div id=\"box_info\">
386
			</div>";
386
			</div>";
387
	}
387
	}
388
	else {
388
	else {
389
		echo "
389
		echo "
390
			<div id=\"box_refuse\">
390
			<div id=\"box_refuse\">
391
				<img src=\"$img_rep$img_false\">
391
				<img src=\"$img_rep$img_false\">
392
				<p>$l_explain</p>
392
				<p>$l_explain</p>
393
			</div>
393
			</div>
394
			<div id=\"liens_redir\">
394
			<div id=\"liens_redir\">
395
				<p>$l_back_page</p>
395
				<p>$l_back_page</p>
396
			</div>";
396
			</div>";
397
		}
397
		}
398
	if (($network_pb)&&(! $direct_access)) {
398
	if (($network_pb)&&(! $direct_access)) {
399
	echo "	<span>Diagnostic : $diagnostic</span>";
399
	echo "	<span>Diagnostic : $diagnostic</span>";
400
	}
400
	}
401
?>
401
?>
402
		</div>
402
		</div>
403
		<div id="corner">
403
		<div id="corner">
404
			<div id="adm" class="corn">
404
			<div id="adm" class="corn">
405
				<a href="https://<?php echo $hostname; ?>/acc/"><img src=<?php echo $img_rep.''.$img_adm; ?>></a>
405
				<a href="https://<?php echo $hostname; ?>/acc/"><img src=<?php echo $img_rep.''.$img_adm; ?>></a>
406
			</div>
406
			</div>
407
		</div>
407
		</div>
408
	</body>
408
	</body>
409
</html>
409
</html>
410
 
410