Subversion Repositories ALCASAR

Rev

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

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