Subversion Repositories ALCASAR

Rev

Rev 2085 | Rev 2105 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
452 richard 1
<?php
958 franck 2
# $Id: index.php 2090 2016-12-12 23:00:01Z richard $
1249 richard 3
#
2085 richard 4
# index.php for ALCASAR by Rexy
1249 richard 5
# UI & css style by stephane ERARD
6
# The contents of this file may be used under the terms of the GNU
7
# General Public License Version 2, provided that the above copyright
8
# notice and this permission notice is included in all copies or
9
# substantial portions of the software.
10
/****************************************************************
11
*			GLOBAL FILE PATHS			*
12
*****************************************************************/
13
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
14
 
15
/****************************************************************
16
*			FILE reading test			*
17
*****************************************************************/
18
$conf_files=array(CONF_FILE);
19
foreach ($conf_files as $file){
20
	if (!file_exists($file)){
21
		exit("File ".$file." unknown");
22
	}
23
	if (!is_readable($file)){
24
		exit("You don't have read rights on the file ".$file);
25
	}
26
}
27
/****************************************************************
28
*			Read CONF_FILE				*
29
*****************************************************************/
30
$ouvre=fopen(CONF_FILE,"r");
31
if ($ouvre){
32
	while (!feof ($ouvre))
33
	{
34
		$tampon = fgets($ouvre, 4096);
35
		if (strpos($tampon,"=")!==false){
36
			$tmp = explode("=",$tampon);
37
			$conf[$tmp[0]] = $tmp[1];
38
		}
39
	}
40
}else{
41
	exit("Error opening the file ".CONF_FILE);
42
}
43
fclose($ouvre);
1345 richard 44
$organisme = trim($conf["ORGANISM"]);
45
$domainname = trim($conf["DOMAIN"]);
46
$hostname = "alcasar.".$domainname;
784 richard 47
$network_pb = False;
1249 richard 48
$cert_add = "http://$hostname/certs";
360 richard 49
$direct_access = False;
1992 richard 50
$display_menu=False;
832 richard 51
$diagnostic = "can't contact the default router";
1452 richard 52
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "";
363 richard 53
$tab = array();$user = array();
566 stephane 54
$connection_history =  "";
55
$nb_connection_history = 3;
1992 richard 56
$Language = 'en';
57
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
58
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
59
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
1999 richard 60
$redirect_link = "www.euronews.com"; # Default redirection for HTTPS interception (beware, this website must run in HTTP)
566 stephane 61
 
1987 richard 62
# Retrieve the user info behind the remote ip
1818 raphael.pi 63
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
64
$user = explode (" ", $tab[0]);
1820 raphael.pi 65
 
1978 raphael.pi 66
 
1992 richard 67
# Test if it's a direct connexion to ALCASAR
1993 richard 68
if (isset($_SERVER['HTTP_HOST']))
1992 richard 69
{
1993 richard 70
	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'])))
71
	{	
522 richard 72
	$direct_access=True;
1992 richard 73
	exec("sudo /usr/sbin/ipset del not_auth_yet $remote_ip"); # del user of the ipset "not_auth_yet" to not loop
1993 richard 74
	}
1992 richard 75
}
1987 richard 76
# Function to adapt time connexion in seconds to H,M,S
566 stephane 77
function secondsToDuration($seconds = null){
78
	if ($seconds == null) return "";
79
	$temp = $seconds % 3600;
80
	$time[0] = ( $seconds - $temp ) / 3600 ;	// hours
732 richard 81
	$time[2] = $temp % 60 ;				// seconds
566 stephane 82
	$time[1] = ( $temp - $time[2] ) / 60;		// minutes
732 richard 83
	return $time[0]." h ".$time[1]." m ".$time[2]." s";
566 stephane 84
}
509 richard 85
 
2010 raphael.pi 86
//if user need to be warn
87
if(isset($_GET['warn']) && isset($_GET['url']))
88
{
89
	$direct_access = False;
90
}
91
 
2085 richard 92
if ((isset ($user[4])) && ($user[4] != "0")){ # the user is authenticated
2010 raphael.pi 93
	if(isset($_GET['redirect'])) # if user has been warned, we redirect him to his website
94
	{
95
		$redir = "http://".$_GET['url'];  
96
		header("Location: $_GET[url]",TRUE,307);
97
		exit; 
98
	}
2085 richard 99
	// we retrieve his three last connections
100
	((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
566 stephane 101
		include_once("/etc/freeradius-web/config.php");
102
		include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
2010 raphael.pi 103
 
566 stephane 104
		$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
2085 richard 105
		$link = @da_sql_pconnect($config);
566 stephane 106
		if ($link){
2085 richard 107
			$res = @da_sql_query($link,$config,$sql);
566 stephane 108
			if ($res){
109
				$connection_history.= "<ul>";
110
				while(($row = @da_sql_fetch_array($res,$config))){
111
					$connected = "";
1987 richard 112
					if ($row['acctstoptime'] == "") $connected = " (active)";
1678 richard 113
					$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row['acctsessiontime']).")'>$row[acctstarttime] (".secondsToDuration($row['acctsessiontime']).") $connected</li>";
566 stephane 114
				}
115
				$connection_history.="</ul>";
116
			}
117
		}
118
	}
119
}
2085 richard 120
else # the user isn't authenticated
1818 raphael.pi 121
{
1978 raphael.pi 122
	exec("sudo /usr/sbin/ipset list not_auth_yet | grep $remote_ip | wc -l 2>&1", $ipset_not_auth_yet);
1999 richard 123
	if(!$direct_access && $ipset_not_auth_yet[0] == '0') # it's the first stage of the interception 
1818 raphael.pi 124
	{
1992 richard 125
		$display_menu = True; # Display menu for user not_auth_yet
1999 richard 126
		if (!isset($_SERVER['HTTPS'])) # In HTTP, the user is redirected on it's home page. In HTTPS, it's on the default page
127
		{
128
			$redirect_link = $_SERVER['HTTP_HOST']; # to keep the user URL
129
		}
130
 
1989 raphael.pi 131
	}
1993 richard 132
	if(isset($_GET['url'])) # it's the second stage (when user has clicked to open a connection ...)
1989 raphael.pi 133
	{
1992 richard 134
		exec("sudo /usr/sbin/ipset add not_auth_yet $remote_ip"); # Add user in the ipset "not_auth_yet" (DNS requests not intercepted)
1999 richard 135
		$redir = "http://".$_GET['url'];  
136
		header("Location: $redir",TRUE,307);
1989 raphael.pi 137
		exit; 
138
	}
1992 richard 139
	if ($ipset_not_auth_yet[0] == '1'){ #if user not_auth_yet still here (index.php), we force DNS resquest.
140
		 echo "<script>window.location.reload(true)</script>"; # force DNS request
141
	}	
2010 raphael.pi 142
 
143
 
1818 raphael.pi 144
}
360 richard 145
# Choice of language
146
if($Language == 'fr'){
2090 richard 147
	$l_access_denied = "Contrôle d'accès";
148
	$l_access_welcome = "Bienvenue sur ALCASAR";
149
	$l_access_unavailable = "ACCÈS INDISPONIBLE";
150
	$l_required_domain = "Site WEB demandé";
151
	$l_explain_acc_access = "Le centre de gestion permet d'administrer le portail. Vous devez posséder un compte d'administration ou de gestion pour y accéder.";
152
	$l_explain_access_deny = "Vous tentez d'accéder à une ressource dont le contenu est réputé contenir des informations inappropriées.";
153
	$l_explain_net_pb = "Votre portail détecte que l'accès à Internet est indisponible.";
154
	$l_contact_access_deny = "Contactez le responsable de la séurité (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
155
	$l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
156
	$l_welcome = "Page principale de votre portail captif";
157
	$l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Enregistrement par SMS</a>";
158
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installer le certificat racine</a>";
159
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Installation du certificat de l'autorité; racine d'ALCASAR</a>";
160
	$l_certif_explain = "Permet l'échange de données sécurisées entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistré sur votre station de consultation, il est possible que des alertes de sécurité soient émises par votre navigateur.<br><br>";
161
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>";
162
	$l_category = "catégorie :";
163
	if ((isset ($user[4])) && ($user[4] == "0")) {
164
		$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre système.";
165
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Ouvrir une session Internet</a>";
1820 raphael.pi 166
	}
2090 richard 167
	else {
168
		if ($user[5] != $user[0]) // authentication exception or not
169
		{
170
			$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
171
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>";
172
		}
173
		else
174
		{
175
			$l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history last connections :$connection_history";
176
			$l_logout = "Information des connexions";
177
		}
832 richard 178
	}
2090 richard 179
	$l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
180
	$l_password_change_explain = "Vous redirige sur la page de changement du mot de passe de votre compte d'accès à Internet.<br><br>Vous devez avoir un compte internet valide.";
181
	$l_sms_explain = "Vous redirige vers 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";
182
	$l_back_page = "<a href=\"javascript:history.back()\">Page précédente</a>";
183
	$l_service_sms = "Service SMS actif";
184
	$l_service_sms_n = "Service SMS non actif";
185
	$l_acc_sms = "Auto enregistrement par SMS";
186
	$l_explain_warn = "L'administrateur a créé une archive contenant vos journaux de connexion dans le cadre d'une affaire judiciaire.";
187
	if(isset($_GET['url']))
188
		$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>Je comprends et je souhaite continuer ma navigation.</a>";
189
	else
190
		$l_continue_link = "<a href='index.php' class='button'>Je comprends et je souhaite continuer ma navigation.</a>";
191
	$l_title_warn="Cher utilisateur, ";
192
	$l_explain_warn_name="Une personne sous le nom de ";
193
	$l_explain_warn_ip="sous cette IP : ";
194
	$l_explain_warn_date="a consulté vos journaux de connexion le ";
195
	$l_explain_warn_reason="Raison invoquée : ";
360 richard 196
}
912 richard 197
else if($Language == 'pt'){
2090 richard 198
	$l_access_denied = "Controle de acesso";
199
	$l_access_welcome = "Bem-vindo ao Alcasar";
200
	$l_access_unavailable = "ACESSO INDISPONÍVEL";
201
	$l_required_domain = "Site WEB Obrigatório";
202
	$l_explain_acc_access = "Este é o centro de controle do portal para acessar você deve ter uma conta administrativa valida.";
203
	$l_explain_access_deny = "Você tenta se conectar a um recurso cujo conteúdo é considerado inadequado no conteúdo de informações.";
204
	$l_explain_net_pb = "O sistema detectou que o acesso é de risco, não será permitido o acesso";
205
	$l_contact_access_deny = "Entre em contato com o administrador do sistema de segurança se acha que essa filtragem é abusiva.";
206
	$l_contact_net_pb = "Entre em contato com a empresa fornecedora de Internet para mais informações";
207
	$l_welcome = "Página do portal";
208
	$l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
209
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
210
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Instalar Certificado Alcasar AC</a>";
211
	$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>";
212
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>";
213
	$l_category = "categoria :";
214
	if ((isset ($user[4])) && ($user[4] == "0")) {
215
		$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
216
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
1820 raphael.pi 217
	}
2090 richard 218
      else {
219
		if ($user[5] != $user[0]) // authentication exception or not
220
		{
221
			$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";
222
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
223
		}
224
		else
225
		{
226
			$l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
227
			$l_logout = "Informações de conexões";
228
		}
229
	}
230
	$l_password_change = "<a href=\"https://$hostname/pass\">Mudar sua senha</a>";
231
	$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.";
232
	$l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
233
	$l_back_page = "<a href=\"javascript:history.back()\">Página anterior</a>";
234
	$l_service_sms = "SMS service enable";
235
	$l_service_sms_n = "SMS service disable";
236
	$l_acc_sms = "Auto registration by SMS";
237
	$l_explain_warn = "El administrador ha creado un archivo que contiene los periódicos de inicio de sesión como parte de un proceso judicial."; 
238
	if(isset($_GET['url']))
239
		$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>Lo comprendo y deseo continuar mi navegación.</a>";
240
	else
241
		$l_continue_link = "<a href='index.php' class='button'>Lo comprendo y deseo continuar mi navegación.</a>";
242
	$l_title_warn="Estimado usuario,";
243
	$l_explain_warn_name="El usario ";
244
	$l_explain_warn_ip="con este IP : ";
245
	$l_explain_warn_date="consultó a sus registros de conexión el ";
246
	$l_explain_warn_reason="con la siguiente razón : ";
912 richard 247
}
2090 richard 248
else if($Language == 'zn'){
249
	$l_access_denied = "访问控制";
250
	$l_access_welcome = "欢迎来到ALCASAR";
251
	$l_access_unavailable = "不可访问";
252
	$l_required_domain = "访问的网站";
253
	$l_explain_acc_access = "管理中心能管理门户,您必须通过超级用户或者管理用户来访问。";
254
	$l_explain_access_deny = "您试图访问一个含有不当信息的资源。";
255
	$l_explain_net_pb = "您的门户检测因特网不可用。";
256
	$l_contact_access_deny = "如果您认为该过滤不当,请联系安全负责人(OSSI/RSSI)。";
257
	$l_contact_net_pb = "请联系IT负责人或网络服务商来了解更多信息。";
258
	$l_welcome = "强制门户主页";
259
	$l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">短信自动登录 </a>";
260
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">安装根证书 </a>";
261
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">安装根证书 </a>";
262
	$l_certif_explain = "允许您的计算机与ALCASAR门户进行安全数据交换。<BR>如果该证书未包含在您的计算机中,您的浏览器将出现一些安全提醒。<br><br>";
263
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">额外帮助</a>";
264
	$l_category = "类别 :";
265
	if ((isset ($user[4])) && ($user[4] == "0")) {
266
		$l_logout_explain = "您的系统目前没有打开任何网络咨询进程。";
267
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">打开一个网络进程</a>";
268
	}
269
	else {
270
		if ($user[5] != $user[0]) // authentication exception or not
271
		{
272
			$l_logout_explain = "关闭当前连接进程。<br> 已连接用户:<a href=\"http://$hostname:3990/logoff\" title=\" $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history 最后连接 :$connection_history";
273
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">断开网络</a>";
274
		}
275
		else
276
		{
277
			$l_logout_explain = "您的系统($user[5])验证例外<br><br>$nb_connection_history 最后连接: $connection_history";
278
			$l_logout = "连接信息";
279
		}
280
	}
281
	$l_password_change = "<a href=\"https://$hostname/pass\">更改您的密码</a>";
282
	$l_password_change_explain = "重新指向密码修改页面。<br><br> 您需要一个可用的网络账户。";
283
	$l_sms_explain = "重新指向短信登录页面。<br><br><strong>用户名:</strong>您的电话号码<br><strong>密码:</strong>您的信息";
284
	$l_back_page = "<a href=\"javascript:history.back()\">上一页</a>";
285
	$l_service_sms = "短信服务可用";
286
	$l_service_sms_n = "短信服务禁用";
287
	$l_acc_sms = "短信自动注册";
288
	$l_explain_warn = "管理员创建了一份可用于司法调查的连接日志文档。";
289
	if(isset($_GET['url']))
290
		$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>我明白并希望继续浏览。</a>";
291
	else
292
		$l_continue_link = "<a href='index.php' class='button'>我明白并希望继续浏览。</a>";
293
	$l_title_warn="亲爱的用户,";
294
	$l_explain_warn_name="一人名为";
295
	$l_explain_warn_ip="在此IP:";
296
	$l_explain_warn_date="查看您的连接日志于";
297
	$l_explain_warn_reason=" 如下原因:";
298
}
360 richard 299
else {
2090 richard 300
	$l_access_denied = "Access control";
301
	$l_access_welcome = "Welcome on ALCASAR";
302
	$l_access_unavailable = "ACCESS UNAVAILABLE";
303
	$l_required_domain = "Required WEB site";
304
	$l_explain_acc_access = "This center control the portal. You must have an administrative account.";
305
	$l_explain_access_deny = "You try to connect to a resource whose content is deemed to contain inappropriate information.";
306
	$l_explain_net_pb = "Your portal has just detected that the Internet access is down";
307
	$l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
308
	$l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
309
	$l_welcome = "Your captive portal main page";
310
	$l_sms_access = "<a href=\"https://$hostname/autoregistrationinfo.php\">Auto Registration by SMS</a>";
311
	$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
312
	$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.der\">Install ALCASAR AC Certificate</a>";
313
	$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>";
314
	$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
315
	$l_category = "category :";
316
	if ((isset ($user[4])) && ($user[4] == "0")) {
317
		$l_logout_explain = "No Internet consultation session is actualy open on your system";
318
		$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Open an Internet session</a>";
1820 raphael.pi 319
	}
2090 richard 320
	else {
321
		if ($user[5] != $user[0]) // authentication exception or not
322
		{
323
			$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";
324
			$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
325
		}
326
		else
327
		{
328
			$l_logout_explain = "Your system ($user[5]) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history";
329
			$l_logout = "Connections information";
330
		}
331
	}
332
	$l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
333
	$l_password_change_explain = "Redirect you on password change page.<br><br> You should already have an Internet access account.";
334
	$l_sms_explain = "Redirect you on auto registration page.<br><br><strong>Login:</strong> your phone number<br><strong>Password:</strong> SMS content";
335
	$l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
336
	$l_service_sms = "SMS service enable";
337
	$l_service_sms_n = "SMS service disable";
338
	$l_acc_sms = "Auto registration by SMS";
339
	$l_explain_warn = "The administrator created an archive which contains your imputabilities logs for a judicial investigation.";
340
	if(isset($_GET['url']))
341
		$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>I understand and I wish to continue.</a>";
342
	else
343
		$l_continue_link = "<a href='index.php' class='button'>I understand and I wish to continue.</a>";
344
	$l_title_warn="Dear user,";
345
	$l_explain_warn_name="Someone called ";
346
	$l_explain_warn_ip="with this IP : ";
347
	$l_explain_warn_date="has read your connexion logs at ";
348
	$l_explain_warn_reason="For this reason : ";
360 richard 349
}
1987 richard 350
 
369 richard 351
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
360 richard 352
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
509 richard 353
 
1987 richard 354
# set the icons
1999 richard 355
$img_rep = "/images/";
509 richard 356
$img_organisme = "organisme.png";
357
$img_access = "globe_acces_70.png";
358
$img_connect = "globe_70.png";
359
$img_warning = "globe_warning_70.png";
360
$img_pwd = "cle_ombre.png";
361
$img_certificate = "certificat.png";
362
$img_acc = "logo-alcasar_70.png";
1452 richard 363
$img_sms = "sms.png";
509 richard 364
$img_false = "interdit.png";
1452 richard 365
$img_adm = "adm.png";
509 richard 366
$img_internet = $img_connect;
367
 
783 richard 368
if ((isset ($user[4])) && ($user[4] == "0")) {
509 richard 369
	if (! $network_pb) {
370
		$img_internet = $img_access;
371
		}
372
		else {
373
		$img_internet = $img_warning;
374
	}
375
}
376
else {
377
	$img_internet = $img_connect;
378
}
379
 
1992 richard 380
# cleaning the cache
381
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
382
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
383
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
384
header("Cache-Control: post-check=0, pre-check=0", false);
385
header("Pragma: no-cache");
360 richard 386
?>
566 stephane 387
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
388
	<html>
389
	<head>
390
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
391
	<title>ALCASAR - <?php echo $l_title; ?></title>
392
	<meta http-equiv="Cache-control" content="no-cache">
393
	<meta http-equiv="Pragma" content="no-cache">
1989 raphael.pi 394
<?php
1992 richard 395
	echo "<style>";
396
	include("css/style_intercept.css");
397
	echo "</style>";
398
?>
399
<script type="text/javascript">
400
	function valoriserDiv5(param){
401
		document.getElementById("box_info").innerHTML = param.innerHTML;
1989 raphael.pi 402
	}
1992 richard 403
</script>
360 richard 404
</head>
566 stephane 405
<body onload="valoriserDiv5(text_conn);">
509 richard 406
<?php
1992 richard 407
if ($direct_access || $display_menu){
360 richard 408
	echo "
566 stephane 409
		<div id=\"cadre_titre\" class=\"titre_controle\">
410
			<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>";
509 richard 411
	if ($network_pb) {
566 stephane 412
		echo "	<span>$l_explain_net_pb</span>";
509 richard 413
		}
360 richard 414
	}
509 richard 415
	else {
2010 raphael.pi 416
		#if user need to be warn about that someone who read his logs
417
		if(isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1')
418
		{
509 richard 419
		echo"
566 stephane 420
			<div id=\"cadre_titre\" class=\"titre_refus\">
2010 raphael.pi 421
			<p id=\"acces_controle\" class=\"titre_refus\">$l_title_warn</p>";
422
		}
423
		else
424
		{
425
		echo"
426
			<div id=\"cadre_titre\" class=\"titre_refus\">
427
			<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>";
428
		}
363 richard 429
	}
360 richard 430
?>
566 stephane 431
			<div id="boite_logo">
1989 raphael.pi 432
				<img src="<?php echo "$img_rep$img_organisme"; ?>">
566 stephane 433
			</div>
434
		</div>
435
		<div id="contenu_acces">
436
			<div id="box_url">
1124 crox53 437
<?php 
1987 richard 438
# search here in the blacklist categories if we want to display it (if ((! $direct_access) && (! $network_pb)){}
1124 crox53 439
?>
566 stephane 440
			</div>
1452 richard 441
<?php
1987 richard 442
# Check if the SMS service is enable
1506 franck 443
$service_SMS_status="false";
444
if ($service_SMS_status == "true") {
1452 richard 445
$sms_div='	
446
			<div class="box_menu" id="box_acc" onmouseover="valoriserDiv5(text_acc);">
447
				<span>'.$l_sms_access.'</span>
448
				<img src="'.$img_rep.''.$img_sms.'">
449
			</div>
450
';
451
 
452
$sms_div_over='			
453
			<div class="div-cache" id="text_acc">
454
				<h2>'.$l_sms_access.'</h2>
455
				<p>'.$l_sms_explain.'</p>
456
				<p><font color="green"><center>'.$l_service_sms.'</center></font></p>
457
				<img src="'.$img_rep.''.$img_sms.'">
458
			</div>
459
';
460
}
1508 richard 461
else {
462
$sms_div='';
463
$sms_div_over='';
464
}
1992 richard 465
if ($direct_access || $display_menu){
566 stephane 466
	echo "	<div id=\"box_bienvenue\">
360 richard 467
				$l_welcome
566 stephane 468
			</div>
469
			<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
470
				<span>$l_logout</span>
471
				<img src=\"$img_rep$img_internet\">
472
			</div>
473
			<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
474
				<span>$l_install_certif</span>
475
				<img src=\"$img_rep$img_certificate\">
476
			</div>
477
			<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
478
				<img src=\"$img_rep$img_pwd\">
479
				<span>$l_password_change</span>
480
			</div>		
1452 richard 481
			$sms_div
566 stephane 482
			<div class=\"div-cache\" id=\"text_conn\">
483
				<h2>$l_logout</h2>
484
				<p>$l_logout_explain</p>
485
				<img src=\"$img_rep$img_internet\">
486
			</div>
487
			<div class=\"div-cache\" id=\"text_certif\">
488
				<h2>$l_install_certif_more</h2>
489
				<p>$l_certif_explain $l_certif_explain_help</p>
490
				<img src=\"$img_rep$img_certificate\">				
491
			</div>
492
			<div class=\"div-cache\" id=\"text_mdp\">
493
				<h2>$l_password_change</h2>
494
				<p>$l_password_change_explain</p>
495
				<img src=\"$img_rep$img_pwd\">
496
			</div>
1452 richard 497
			$sms_div_over
566 stephane 498
			<div id=\"box_info\">
499
			</div>";
509 richard 500
	}
1989 raphael.pi 501
else {
2010 raphael.pi 502
	#if user need to be warn about that someone who read his logs
503
	if(isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1')
504
	{
505
 
506
 
507
	$filename="/var/www/html/acc/backup/log_info.txt";
508
	$l_explain_warn="";
509
	if(file_exists($filename)){
510
		$fichier = fopen($filename, "r");
511
		$content = file($filename);
512
        	foreach($content as $line){
513
			$infos=explode("|||", $line);
514
			$log_date=$infos[0];	
515
			$log_user=$infos[1];	
516
			$log_reason=$infos[2];	
517
			$log_ip=$infos[3];	
518
		}
519
 
520
		$l_explain_warn="$l_explain_warn_name$log_user ( $l_explain_warn_ip$log_ip ) $l_explain_warn_date$log_date $l_explain_warn_reason$log_reason";
521
	}
522
	else
523
	{
524
		echo "Log error!";
525
	}
526
 
527
 
528
	echo "
529
		<div id=\"box_refuse\">
530
			<img src=\"$img_rep$img_warning\">
531
			<p>$l_explain_warn</p>
532
 
533
		</div>
534
		<div id=\"liens_redir\">
535
			<p>$l_continue_link</p>
536
		</div>";
537
 
538
	}
539
	else
540
	{
509 richard 541
		echo "
566 stephane 542
			<div id=\"box_refuse\">
509 richard 543
				<img src=\"$img_rep$img_false\">
566 stephane 544
				<p>$l_explain</p>
545
			</div>
546
			<div id=\"liens_redir\">
547
				<p>$l_back_page</p>
548
			</div>";
2010 raphael.pi 549
	}
550
}
509 richard 551
	if (($network_pb)&&(! $direct_access)) {
566 stephane 552
	echo "	<span>Diagnostic : $diagnostic</span>";
509 richard 553
	}
363 richard 554
?>
566 stephane 555
		</div>
1452 richard 556
		<div id="corner">
557
			<div id="adm" class="corn">
1729 richard 558
				<a href="https://<?php echo $hostname; ?>/acc/"><img src=<?php echo $img_rep.''.$img_adm; ?>></a>
1452 richard 559
			</div>
560
		</div>
566 stephane 561
	</body>
1822 raphael.pi 562
</html>
1989 raphael.pi 563
 
564