Subversion Repositories ALCASAR

Rev

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

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

Generated by GNU Enscript 1.6.6.
-
 
427
 
-
 
428
 
-
 
429