Subversion Repositories ALCASAR

Rev

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

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