Subversion Repositories ALCASAR

Rev

Rev 404 | Rev 498 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
452 richard 1
<?php
2
$private_ip = "192.168.182.1";
360 richard 3
$network_pb = False;
4
$direct_access = False;
363 richard 5
$diagnostic = "eth0 link down";
6
$remote_ip = ($_SERVER['REMOTE_ADDR']);
7
$tab = array();$user = array();
8
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
9
$user = explode (" ", $tab[0]);
360 richard 10
# on discrimine les accès directs sur Alcasar par rapport aux redirections
11
if (($_SERVER['HTTP_HOST'] == $private_ip) || ($_SERVER['HTTP_HOST'] == "alcasar")){$direct_access=True;}
12
# Choice of language
13
$Language = 'en';
14
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
15
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
16
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
17
if($Language == 'fr'){
18
  $l_access_denied = "ACC&Egrave;S REFUS&Eacute;";
399 franck 19
  $l_access_welcome = "Bienvenue sur ALCASAR";
360 richard 20
  $l_access_unavailable = "ACC&Egrave;S INDISPONIBLE";
21
  $l_required_domain = "Site WEB demand&eacute;";
369 richard 22
  $l_explain_acc_access = "Ce centre permet d'administrer le portail. Vous devez poss&eacute;der un compte d'administration.";
360 richard 23
  $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.";
24
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
25
  $l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
26
  $l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information";
399 franck 27
  $l_welcome = "Page principale de votre portail captif";
404 franck 28
  $l_acc_access = "<a href=\"https://$private_ip/acc\">Acc&egrave;s au centre de gestion (ALCASAR Control Center)</A>";
369 richard 29
  if ($user[4] == "0") {
30
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me";
31
	  $l_logout = "<a href=\"http://www.google.fr\">Ouvrir une session Internet</A>";}
32
  else {
33
	  $l_logout_explain = "Ferme la session de l'usager : <b>$user[5]</b>";
34
	  $l_logout = "<a href=\"http://$private_ip:3990/logoff\">D&eacute;connexion</A>";}
360 richard 35
  $l_password_change = "<a href=\"https://$private_ip/pass\">Changer votre mot de passe</A>";
369 richard 36
  $l_password_change_explain = "Vous devez poss&eacute;der un compte de consultation Internet.";
360 richard 37
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
38
}
39
else {
40
  $l_access_denied = "ACCESS DENIED";
369 richard 41
  $l_access_welcome = "Welcome on ALCASAR";
360 richard 42
  $l_access_unavailable = "ACCESS UNAVAILABLE";
43
  $l_required_domain = "Required WEB site";
369 richard 44
  $l_explain_acc_access = "This center control the portal. You must have an administrative account.";
360 richard 45
  $l_explain_access_deny = "Your portal has just detected that the Internet access is down";
46
  $l_explain_net_pb = "Your portal has just detected that the Internet access is down";
47
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
48
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
369 richard 49
  $l_welcome = "Your captive portal main page";
50
  $l_acc_access = "<a href=\"https://$private_ip/acc\">Access to the ALCASAR Control Center</A>";
51
  if ($user[4] == "0") {
52
	  $l_logout_explain = "No Internet consultation session is actualy open on your system";
53
	  $l_logout = "<a href=\"http://www.google.fr\">Open an Internet session</A>";}
54
  else {
55
	  $l_logout_explain = "Close the session of the user : <b>$user[5]</b>";
56
	  $l_logout = "<a href=\"http://$private_ip:3990/logoff\">Logoff</A>";}
57
  $l_password_change = "<a href=\"https://$private_ip/pass\">Change your password</A>";
58
  $l_password_change_explain = "You should already have an Internet access account.";
360 richard 59
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
60
}
369 richard 61
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
360 richard 62
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
452 richard 63
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
64
echo "<html><head><title>ALCASAR - $l_title";
360 richard 65
?>
66
	</title>
67
	<LINK rel=stylesheet type=text/css href="css/style_intercept.css">
68
</head>
69
 
70
	<BODY>
71
<?
72
if ($direct_access){
73
	echo "
74
		<DIV id=\"cadre_titre\" class=\"titre_controle\">
75
			<P id=\"acces_controle\" class=\"titre_controle\">$l_title</P>";
363 richard 76
if ($network_pb) {
77
	echo "	<SPAN>$l_explain_net_pb</SPAN>";
360 richard 78
	}
363 richard 79
	}
360 richard 80
else {
81
	echo"
82
		<DIV id=\"cadre_titre\" class=\"titre_refus\">
83
			<P id=\"acces_controle\" class=\"titre_refus\">$l_title</P>";
84
	}
85
?>
86
			<DIV id="boite_logo">
87
				<IMG src="images/organisme.png">
88
			</DIV>
89
		</DIV>
90
		<DIV id="contenu_acces">
91
			<DIV id="box_url">
92
				<? if (! $direct_access){echo "$l_required_domain : $_SERVER[HTTP_HOST]";}?>
93
			</DIV>
94
<? if ($direct_access){
369 richard 95
	echo "	<DIV id=\"box_bienvenue\">
360 richard 96
				$l_welcome
97
			</DIV>
98
			<DIV class=\"box_menu_courte\" id=\"box_1\">
99
				<IMG src=\"images/cle.png\">
100
				<SPAN>$l_password_change</SPAN>
101
				<P>$l_password_change_explain</P>
369 richard 102
			</DIV>";
103
		if ($user[4] == "0") {
104
			echo "
360 richard 105
			<DIV class=\"box_menu_courte\" id=\"box_2\">
369 richard 106
			<SPAN>";
107
			if (! $network_pb) { echo "$l_logout";}
108
			echo " </SPAN>
109
				<IMG src=\"images/globe_acces.png\">
110
				<P>$l_logout_explain</P>
111
			</DIV>";}
112
			else {
113
			echo "
114
			<DIV class=\"box_menu_courte\" id=\"box_2\">
360 richard 115
				<SPAN>$l_logout</SPAN>
116
				<IMG src=\"images/globe.png\">
117
				<P>$l_logout_explain</P>
369 richard 118
			</DIV>";}
119
	echo "	<DIV class=\"box_menu_large\" id=\"box_3\">
360 richard 120
				<SPAN>$l_acc_access</SPAN>
121
				<IMG src=\"images/logo-alcasar.png\">
122
				<P>$l_explain</P>
123
			</DIV>";}
124
	else {echo "
125
			<DIV id=\"box_refuse\">
126
				<img src=\"images/interdit.png\">
127
				<P>$l_explain</P>
128
			</DIV>
129
			<DIV id=\"liens_redir\">
130
				<P>$l_back_page</P>
363 richard 131
			</DIV>";}
132
	if (($network_pb)&&(! $direct_access))
133
			{
134
	echo "		<SPAN>Diagnostic : $diagnostic</SPAN>";
135
}
136
?>
360 richard 137
		</DIV>
138
	</BODY>
139
</html>