Subversion Repositories ALCASAR

Rev

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

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