Subversion Repositories ALCASAR

Rev

Rev 930 | Rev 958 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
895 richard 1
<?php
2
#
3
# intercept.php for Alcasar captive portal
4
# Copyright (C) 2003, 2004 Mondru AB.
5
# Modify by REXY & steweb57
6
# UI & css style by stephane ERARD
7
# Help for language translation by B. AUBARD (thanks)
8
 
9
# The contents of this file may be used under the terms of the GNU
10
# General Public License Version 2, provided that the above copyright
11
# notice and this permission notice is included in all copies or
12
# substantial portions of the software.
13
 
14
# Redirects from CoovaChilli (chilli daemon) :
15
# Response to login:
16
  # success :	if login successful
17
  # failed :	if login failed
18
  # logoff :	if logout successful
19
  # already :	if tried to login while already logged in
20
  # notyet :	if not logged in yet
21
  # Default :	it was not a form request -> client go to login form
22
 
23
/****************************************************************
24
*			GLOBAL FILE PATHS			*
25
*****************************************************************/
26
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
913 richard 27
define ("DOMAIN_ALLOWED_LIST", "/usr/local/etc/alcasar-uamdomain");
895 richard 28
 
29
/****************************************************************
930 richard 30
*			FILE reading test			*
895 richard 31
*****************************************************************/
930 richard 32
$conf_files=array(CONF_FILE,DOMAIN_ALLOWED_LIST);
913 richard 33
foreach ($conf_files as $file){
34
	if (!file_exists($file)){
35
		exit("Fichier ".$file." non présent");
36
	}
37
	if (!is_readable($file)){
38
		exit("Vous n'avez pas les droits de lecture sur le fichier ".$file);
39
	}
40
}
895 richard 41
/****************************************************************
42
*			Read CONF_FILE				*
43
*****************************************************************/
44
$ouvre=fopen(CONF_FILE,"r");
45
if ($ouvre){
46
	while (!feof ($ouvre))
47
	{
48
		$tampon = fgets($ouvre, 4096);
49
		if (strpos($tampon,"=")!==false){
50
			$tmp = explode("=",$tampon);
51
			$conf[$tmp[0]] = $tmp[1];
52
		}
53
	}
54
}else{
55
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH1);
56
}
57
fclose($ouvre);
58
$organisme = $conf["ORGANISM"];
59
 
60
# Shared secret used to encrypt challenge with radius.
930 richard 61
$uamsecret = "";
895 richard 62
 
63
# URL loaded after success authenticates (let blank for browser defaults)
64
$adminurl = "";
65
 
66
# Our own path
67
$loginpath	= $_SERVER['PHP_SELF'];
68
$alcasarpath = "http://alcasar";
69
$statuspath = $alcasarpath."/status.php";
70
$debug		= false;
71
 
72
# Choice of language
73
$Language = 'en';
74
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
75
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
76
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
77
if($Language == 'es'){
78
  $l_ChilliError	= "La autenticación debe ser un éxito a través del servicio de portal cautivo.";
79
  $l_login		= "El éxito de la autenticación.<HR>Cierre esta ventana interrumpte la sesion.";
80
  $l_logout		= "Conexión de cierre";
81
  $l_loginfailed	= "Error de autenticación";
82
  $l_loggingin		= "Identificación en el portal cautivo";
83
  $l_loggedcont		= "Control de Acceso";
84
  $l_loggedout		= "Su sesión se cierra";
85
  $l_user		= "Usuario";
86
  $l_password		= "Contraseña";
87
  $l_wait		= "Por favor, espere un momento ...";
88
  $l_onlinetime		= "Tiempo de conexión:";
89
  $l_remainingtime	= "Desconexión en:";
90
  $l_encrypted		= "La apertura debe usar conexión cifrada";
91
  $l_boutonO		= "Autenticación";
92
  $l_boutonF		= "Cerrar";
930 richard 93
  $l_loggedin_stringl1	= "Information System Security";
94
  $l_loggedin_stringl2	= "El portal fue creado reglamentos para garantizar la trazabilidad, la rendición de cuentas y el no repudio de las conexiones.";
95
  $l_loggedin_stringl3	= "Su actividad en la red es registrada, de conformidad con la privacidad.";
96
  $l_loggedin_stringl4	= "Los datos registrados pueden ser capaces de ser operado por una autoridad judicial en el curso de una investigación.";
97
  $l_loggedin_stringl5	= "Estos datos se eliminan automáticamente después de un año.";
98
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
99
  $l_loggedout_string	= "Cerrar sesión hizo portal cautivo!";
100
  $l_reply_1		= "Your daily connexion time has been reached";
101
  $l_reply_2		= "Your monthly connexion time has been reached";
102
  $l_reply_3		= "You try to connect outside of your allowed timespan";
103
  $l_reply_4		= "your account expired";
104
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
105
  $l_reply_6		= "Your authorized connexion time has been reached";
106
  $l_online_time	= "Tiempo en linea";
107
  $l_remaining_time	= "Tiempo restante";
108
  $l_uam_domain		= "Sitios web autorizados : ";}
913 richard 109
else if ($Language == 'pt'){
955 richard 110
  $l_ChilliError	= "A autenticação precisa ser bem sucedida através do portal.";
111
  $l_login		= "Sucesso na autenticação.<HR>Matenha esse pop-up apenas minimizado para não interromper a conexão";
112
  $l_logout		= "Encerrar conexão";
913 richard 113
  $l_loginfailed	= "Falha na autenticação";
114
  $l_loggingin		= "Identificação do portal cativo";
922 richard 115
  $l_loggedcont		= "Controle de acesso";
955 richard 116
  $l_loggedout		= "Sua sessão foi fechada";
913 richard 117
  $l_user		= "Usuário";
118
  $l_password		= "Senha";
119
  $l_wait		= "Por favor, aguarde um momento ...";
120
  $l_onlinetime		= "Tempo de conexão:";
121
  $l_remainingtime	= "Desconectado em:";
122
  $l_encrypted		= "A conexão com o portal deve ser criptografada";
123
  $l_boutonO		= "Autenticação";
124
  $l_boutonF		= "Fechar";
955 richard 125
  $l_loggedin_stringl1	= "Sistema de Informação e segurança";
126
  $l_loggedin_stringl2	= "Este controle foi criado para garantir acesso seguro.";
127
  $l_loggedin_stringl3	= "A autenticação será criptografada em 256 bits, impedindo captura por escâner de rede.";
128
  $l_loggedin_stringl4	= "Sua atividade na Internet será resguardada de acordo com os regulamentos da lei.";
129
  $l_loggedin_stringl5	= "Mantendo ainda sua privacidade em segurança.";
130
  $l_loggedin_stringl6	= "Clique <a href='$alcasarpath'>aqui</a> para alterar sua senha, instalar certificado ou sair do portal.";
131
  $l_loggedout_string	= "desconexão do portal cativo";
132
  $l_reply_1		= "Seu tempo de conexão diária foi finalizado";
921 richard 133
  $l_reply_2		= "Seu tempo de conexão mensal foi finalizado";
134
  $l_reply_3		= "Você tenta conectar-se fora do seu período de tempo permitido";
135
  $l_reply_4		= "Sua conta expirou";
136
  $l_reply_5		= "Você atingiu o número máximo de logins simultâneos";
137
  $l_reply_6		= "Seu tempo de conexão autorizada finalizou";
138
  $l_online_time	= "Tempo Online";
139
  $l_remaining_time	= "Tempo restante";
925 richard 140
  $l_uam_domain		= "Sites autorizados : ";}
895 richard 141
else if($Language == 'de'){
142
  $l_ChilliError	= "Die Authentifizierung ist erfolgreich durch die Nutzung des Portals erfolgt.";
143
  $l_login		= "Erfolgreiche Authentifizierung.<HR>Schlißen dieses fensters unterbricht die sitzung";
144
  $l_logout		= "Beenden der Verbindung";
145
  $l_loginfailed	= "Authentifizierungsfehler Eigenverbrauch";
146
  $l_loggingin		= "Kennzeichnung auf dem Eigenverbrauch";
147
  $l_loggedcont		= "Zutrittskontrolle";
148
  $l_loggedout		= "Ihre Sitzung ist geschlossen";
149
  $l_user		= "Benutzer";
150
  $l_password		= "Passwort";
151
  $l_wait		= "Bitte warten Sie einen Moment ...";
152
  $l_onlinetime		= "Online-Zeit:";
153
  $l_remainingtime	= "Abmelden:";
154
  $l_encrypted		= "Die Öffnung muß der Anschluß Zahlen";
155
  $l_boutonO		= "Authentifizierung";
156
  $l_boutonF		= "Schließen";
930 richard 157
  $l_loggedin_stringl1	= "Information System Security";
158
  $l_loggedin_stringl2	= "Dieses Portal wurde eingerichtet, um ordnungsgemäß die Rückverfolgbarkeit, der Zurechenbarkeit und der Nicht-Anerkennung der Verbindungen.";
159
  $l_loggedin_stringl3	= "Ihre Tätigkeit im Netzwerk registriert ist nach Schutz der Privatsphäre.";
160
  $l_loggedin_stringl4	= "Die gespeicherten Daten nicht pouront genutzt werden, dass von einer Justizbehörde im Rahmen einer Untersuchung.";
161
  $l_loggedin_stringl5	= "Diese Daten werden automatisch gelöscht nach einem Jahr.";
162
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
163
  $l_loggedout_string	= "Trennung des Portals erfolgt Gefangener!";
164
  $l_reply_1		= "Your daily connexion time has been reached";
165
  $l_reply_2		= "Your monthly connexion time has been reached";
166
  $l_reply_3		= "You try to connect outside of your allowed timespan";
167
  $l_reply_4		= "your account expired";
168
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
169
  $l_reply_6		= "Your authorized connexion time has been reached";
170
  $l_online_time	= "Online-zeit";
171
  $l_remaining_time	= "Restzeit";
172
  $l_uam_domain		= "Autorisierten websites : ";}
895 richard 173
else if($Language == 'nl'){
174
  $l_ChilliError	= "De authenticatie moet een succes worden via de captive portal dienst.";
175
  $l_login		= "Succesvolle authenticatie.<HR>Dit venster te sluiten onderbreekt uw sessie.";
176
  $l_logout		= "Slotkoers verbinding";
177
  $l_loginfailed	= "Authenticatie mislukt";
178
  $l_loggingin		= "Identificatie van de captive-portaal";
179
  $l_loggedcont		= "toegangscontrole";
180
  $l_loggedout		= "Uw sessie is gesloten";
181
  $l_user		= "Gebruiker";
182
  $l_password		= "Wachtwoord";
183
  $l_wait		= "Wacht een moment ...";
184
  $l_onlinetime		= "Sluit tijd:";
185
  $l_remainingtime	= "Verbreking in:";
186
  $l_encrypted		= "De opening moet gebruiken gecodeerde verbinding";
187
  $l_boutonO		= "Authenticatie";
188
  $l_boutonF		= "Sluiten";
930 richard 189
  $l_loggedin_stringl1	= "Information System Security";
190
  $l_loggedin_stringl2	= "Het portaal werd opgericht verordeningen om de traceerbaarheid, verantwoordelijkheid en onloochenbaarheid van de verbindingen.";
191
  $l_loggedin_stringl3	= "Uw activiteit op het netwerk is geregistreerd in overeenstemming met de persoonlijke levenssfeer.";
192
  $l_loggedin_stringl4	= "De geregistreerde gegevens kunnen worden kunnen worden bediend door een rechterlijke instantie in de loop van een onderzoek.";
193
  $l_loggedin_stringl5	= "Deze gegevens worden automatisch verwijderd na een jaar.";
194
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
195
  $l_loggedout_string	= "Logout gemaakt intern portaal!";
196
  $l_reply_1 		= "Your daily connexion time has been reached";
197
  $l_reply_2		= "Your monthly connexion time has been reached";
198
  $l_reply_3		= "You try to connect outside of your allowed timespan";
199
  $l_reply_4		= "your account expired";
200
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
201
  $l_reply_6		= "Your authorized connexion time has been reached";
202
  $l_online_time	= "Online tijd";
203
  $l_remaining_time	= "Reterende tijd";
204
  $l_uam_domain		= "Geautoriseerde website : ";}
895 richard 205
else if($Language == 'fr'){
925 richard 206
  $l_ChilliError	= "L'authentification doit être réussie sur le portail captif.";
207
  $l_login		= "Authentification réussie.<HR>La fermeture de cette fenêtre interrompt votre session.";
895 richard 208
  $l_logout		= "Fermeture de la session";
209
  $l_loginfailed	= "Echec d'authentification";
210
  $l_loggingin		= "Identification sur le portail captif";
925 richard 211
  $l_loggedcont		= "Contrôle d'accès";
895 richard 212
  $l_loggedout		= "Votre session est fermée";
213
  $l_user		= "Identifiant";
214
  $l_password		= "Mot de passe";
215
  $l_wait		= "Patientez un instant ...";
216
  $l_onlinetime		= "Temps de connexion:";
217
  $l_remainingtime	= "Deconnexion dans :";
925 richard 218
  $l_encrypted		= "La connexion avec le portail doit être chiffrée";
895 richard 219
  $l_boutonO		= "Authentification";
220
  $l_boutonF		= "Fermer";
930 richard 221
  $l_loggedin_stringl1	= "Sécurité des Systèmes d'Information";
222
  $l_loggedin_stringl2	= "Ce contrôle a été mis en place pour assurer réglementairement la traçabilité, l'imputabilité et la non-répudiation des connexions.";
223
  $l_loggedin_stringl3	= "Votre activité sur le réseau est enregistrée conformément au respect de la vie privée.";
224
  $l_loggedin_stringl4	= "Les données enregistrées ne pourront être exploitées que par une autorité judiciaire dans le cadre d'une enquête.";
225
  $l_loggedin_stringl5	= "Ces données seront automatiquement supprimées au bout d'un an.";
226
  $l_loggedin_stringl6	= "Cliquez <a href='$alcasarpath'>ici</a> pour changer votre mot de passe ou pour intégrer le certificat de sécurité à votre navigateur";
227
  $l_loggedout_string	= "Déconnexion du portail captif effectuée !";
228
  $l_reply_1		= "Votre durée de connexion journaliè a été atteinte";
229
  $l_reply_2		= "Votre durée de connexion mensuelle a été atteinte";
230
  $l_reply_3		= "Vous tentez de vous connecter en dehors de votre période autorisée";
231
  $l_reply_4		= "Votre compte a expiré";
232
  $l_reply_5		= "Vous avez atteint le nombre maximum de connexions simultanées";
233
  $l_reply_6		= "Votre durée de connexion autorisée a été atteinte";
234
  $l_online_time	= "Temps de connexion";
235
  $l_remaining_time	= "Temps restant";
236
  $l_uam_domain		= "Sites autorisés : ";}
895 richard 237
else{
238
  $l_ChilliError	= "The authentication must be successful through the captive portal service.";
239
  $l_login		= "Successful authentication.<HR>Closing this window interrupts your session";
240
  $l_logout		= "Closing connection";
241
  $l_loginfailed	= "Authentication Failed";
242
  $l_loggingin		= "Identification on the captive portal";
243
  $l_loggedcont		= "Access Control";
244
  $l_loggedout		= "Your session is closed";
245
  $l_user		= "User";
246
  $l_password		= "Password";
247
  $l_wait		= "Please wait a moment ...";
248
  $l_onlinetime		= "Connect time:";
249
  $l_remainingtime	= "Disconnection in:";
250
  $l_encrypted		= "The connection with the portal must be encrypted";
251
  $l_boutonO		= "Authentication";
252
  $l_boutonF		= "Close";
930 richard 253
  $l_loggedin_stringl1	= "Information System Security";
254
  $l_loggedin_stringl2	= "That control was set up regulations to ensure traceability, accountability and non-repudiation of connections.";
255
  $l_loggedin_stringl3	= "Your activity on the network is registered in accordance with privacy.";
256
  $l_loggedin_stringl4	= "The recorded data can be able to be operated by a judicial authority in the course of an investigation.";
257
  $l_loggedin_stringl5	= "These data will be automatically deleted after one year.";
258
  $l_loggedin_stringl6	= "Click <a href='$alcasarpath'>here</a> to change your password or to integrate the security certificate in your browser";
259
  $l_loggedout_string	= "Disconnection of the captive portal made";
260
  $l_reply_1		= "Your daily connexion time has been reached";
261
  $l_reply_2		= "Your monthly connexion time has been reached";
262
  $l_reply_3		= "You try to connect outside of your allowed timespan";
263
  $l_reply_4		= "your account expired";
264
  $l_reply_5		= "You have reached the maximum number of simultaneous logins";
265
  $l_reply_6		= "Your authorized connexion time has been reached";
266
  $l_online_time	= "Online time";
267
  $l_remaining_time	= "Remaining time";
268
  $l_uam_domain		= "Authorized websites : ";}
895 richard 269
 
270
# If https not use, tell it's wrong
271
if (!(isset($_SERVER['HTTPS'])&&($_SERVER['HTTPS'] == 'on'))) {
925 richard 272
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
895 richard 273
<html>
274
<head>
275
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
276
  <title>$l_loggedcont</title>
277
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
278
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
279
</head>
280
<body bgColor = 'white'>
281
  <h1 style=\"text-align: center;\">$l_loginfailed</h1>
282
  <center>$l_encrypted</center>
283
</body>
284
</html>";
285
    exit(0);
286
}
287
 
288
# Read form parameters which we care about
289
if (isset($_POST['UserName'])){	$username	= $_POST['UserName'];} else {$username="";}
290
if (isset($_POST['Password'])){	$password	= $_POST['Password'];} else {$password="";}
291
if (isset($_POST['challenge'])){$challenge	= $_POST['challenge'];} else {$challenge="";}
292
if (isset($_POST['button'])){	$button		= $_POST['button'];} else { $button="";}
293
//if (isset($_POST['logout'])){	$logout		= $_POST['logout'];} else {$logout="";}
294
//if (isset($_POST['prelogin'])){	$prelogin	= $_POST['prelogin'];} else {$prelogin="";}
295
if (isset($_POST['res'])){		$res		= $_POST['res'];} else {$res="";}
296
if (isset($_POST['uamip'])){	$uamip		= $_POST['uamip'];} else {$uamip="";}
297
if (isset($_POST['uamport'])){	$uamport	= $_POST['uamport'];} else {$uamport="";}
298
if (isset($_POST['userurl'])){	$userurl	= $_POST['userurl'];} else {$userurl="";}
299
if (isset($_POST['timeleft'])){	$timeleft	= $_POST['timeleft'];} else {$timeleft="";}
300
if (isset($_POST['redirurl'])){	$redirurl	= $_POST['redirurl'];} else {$redirurl="";}
301
 
302
# Read query parameters which we care about
303
if (isset($_GET['res']))		$res		= $_GET['res'];
304
if (isset($_GET['challenge']))	$challenge	= $_GET['challenge'];
305
if (isset($_GET['uamip']))		$uamip		= $_GET['uamip'];
306
if (isset($_GET['uamport']))	$uamport	= $_GET['uamport'];
307
if (isset($_GET['reply'])){		$reply		= $_GET['reply'];} else {$reply="";}
308
if (isset($_GET['userurl']))	$userurl	= $_GET['userurl'];
309
if (isset($_GET['timeleft']))	$timeleft	= $_GET['timeleft'];
310
if (isset($_GET['redirurl']))	$redirurl	= $_GET['redirurl'];
311
 
312
# translation of radius replies
313
if (isset($reply)){
314
	switch(trim ($reply)) {
315
  case 'Your maximum daily usage time has been reached' : $reply = $l_reply_1 ; break;
316
  case 'Your maximum monthly usage time has been reached' : $reply = $l_reply_2 ; break;
317
  case 'You are calling outside your allowed timespan' : $reply = $l_reply_3 ; break;
318
  case 'Password Has Expired' : $reply =  $l_reply_4 ; break;
319
  case 'You are already logged in - access denied' : $reply = $l_reply_5 ; break;
320
  case 'Your maximum never usage time has been reached' : $reply = $l_reply_6 ; break;
321
  }}
322
 
323
# If attempt to login
324
if ("$button" == "$l_boutonO") {
325
  $hexchal = pack ("H32", $challenge);
326
  $newchal = pack ("H*", md5($hexchal . $uamsecret));
327
  $response = md5("\0" . $password . $newchal);
328
  $newpwd = pack("a32", $password);
329
  $pappassword = implode ("", unpack("H32", ($newpwd ^ $newchal)));
925 richard 330
  echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
895 richard 331
<html>
332
<head>
333
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
334
  <title>$l_loggingin</title>
335
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
336
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
337
  <meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/logon?username=$username&password=$pappassword&userurl=$userurl\">
338
  </head>
339
<body bgColor = 'white'>
340
<h1 style=\"text-align: center;\">$l_loggingin</h1>
341
  <center>
342
    $l_wait
343
  </center>
344
</body>
345
</html>";
346
exit(0);
347
}
348
 
349
switch($res) {
350
  case 'success':     $result =  1; break; // If login successful
351
  case 'failed':      $result =  2; break; // If login failed
352
  case 'logoff':      $result =  3; break; // If logout successful
353
  case 'already':     $result =  4; break; // If tried to login while already logged in
354
  case 'notyet':      $result =  5; break; // If not logged in yet
355
  default: $result = 0; // Default: It was not a form request -> client go to login form
356
}
357
 
358
# Otherwise it was not a form request
359
# Send out an error message
360
if ($result == 0) {	//erreur
925 richard 361
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
895 richard 362
<html>
363
<head>
364
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
365
  <title>$l_loggingin</title>
366
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
367
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
368
  <meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/prelogin\">
369
  </head>
370
<body bgColor = 'white'>
371
<h1 style=\"text-align: center;\">$l_loggingin</h1>
372
  <center>
373
    $l_wait
374
  </center>
375
</body>
376
</html>";
377
    exit(0);
378
}
379
# Generate the output
925 richard 380
echo "<!DOCTYPE html>
895 richard 381
<html>
382
<head>
383
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
384
  <title>$l_loggingin</title>
385
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
386
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
387
  <script type=\"text/javascript\" language=\"JavaScript\">
388
    var blur = 0; // not un use
389
	var mytimeleft = 0; // not un use
390
	alcasar_popup = null;
391
 
392
    function popUp(URL) {
393
      if (self.name != \"alcasar_popup\") {
394
        alcasar_popup = window.open(URL, 'alcasar_popup', 'width=500,height=460,directories=no,resizable=no,scrollbars=yes,location=no,toolbar=no,statusbar=no,menubar=no');
395
      }
396
    }
397
 
398
    function doOnLoad(result, userurl, redirurl, adminurl, timeleft) {
399
	    if (timeleft) { // not in use
400
        mytimeleft = timeleft;
401
      }
402
      if ((result == 1)||(result == 4)) {	//success or already
403
	      //window.location = userurl;
404
		  if (alcasar_popup != null) alcasar_popup.focus();
405
 
406
		  if (adminurl != ''){
407
			  window.location = adminurl;
408
		  } else if (redirurl != '') {
409
			  window.location = redirurl;
410
		  } else if (userurl != '') {
411
			  window.location = userurl;
412
		  } else {
413
			  window.home();
414
		  }
415
      }
416
      if ((result == 2) || (result == 3) || result == 5) { //failed or logoff or notyet
417
		if (alcasar_popup != null) alcasar_popup.close();
418
			document.form1.UserName.focus();
419
      }
420
    }
421
  </script>
422
<link rel=\"stylesheet\" href=\"/css/style_intercept.css\" type=\"text/css\">
423
</head>
424
<body onLoad=\"javascript:doOnLoad($result,'$userurl','$redirurl','$adminurl','$timeleft')\">
425
  <center>";
426
if ($result == 2 || $result == 3 || $result == 5) { //failed or logoff or notyet
427
  echo "
428
	<div id=\"logon\">
429
	<h1>$organisme</h1>
430
	<h2>$l_loggedcont</h2>";
431
	if ($result == 2) { //failed
432
		echo "	
433
		<h3>$l_loginfailed</h3>";
434
		if ($reply) {
435
		#traitement du reply ...
436
		echo "<center> $reply <br /><br /></center>";
437
		}
438
	}
439
	echo "
440
	<img id=\"logo-alcasar\" src=\"/images/logo-alcasar.png\">
441
	<form name=\"form1\" method=\"post\" action=\"$loginpath\">
442
	<input type=\"hidden\" name=\"challenge\" value=\"$challenge\">
443
	<input type=\"hidden\" name=\"uamip\" value=\"$uamip\">
444
	<input type=\"hidden\" name=\"uamport\" value=\"$uamport\">
445
	<input type=\"hidden\" name=\"userurl\" value=\"$userurl\">
925 richard 446
	<table id=\"boite-logon\">
447
		<tr>
448
			<td width=\"20%\" rowspan=\"3\"><img id=\"logo-organ\" src=\"/images/organisme.png\"></td>
449
			<td width=\"30%\" align=\"right\">$l_user</td>
450
			<td width=\"50%\" align=\"left\"><INPUT type=\"text\" maxLength=\"32\" name=\"UserName\" autocomplete=\"off\"></td>
451
		</tr>
452
		<tr>
453
			<td align=\"right\">$l_password</td>
454
			<td align=\"left\"><INPUT maxLength=\"32\" type=\"password\" name=\"Password\" autocomplete=\"off\"></td>
455
		</tr>
456
		<tr>
457
			<td height=\"23\" colSpan=\"2\" align=\"center\"><INPUT value=\"$l_boutonO\" type=\"submit\" name=\"button\" onclick=\"javascript:popUp('$statuspath')\"></td>
458
		</tr>
459
	</table>
460
	</form>
461
	<table id=\"boite-info\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\">
462
		<tr>
463
			<td align=\"center\"><FONT color=\"red\"><B>$l_loggedin_stringl1</B></FONT></td>
464
		</tr>
465
		<tr>
466
			<td align=\"left\">
467
				<ul>
468
					<LI>$l_loggedin_stringl2</LI>
469
					<LI>$l_loggedin_stringl4</LI>
470
					<LI>$l_loggedin_stringl3</LI>
471
					<LI>$l_loggedin_stringl5</LI>
472
					<LI>$l_loggedin_stringl6</LI>
473
				</ul>
474
			</td>
475
		</tr>
476
	</table>";
913 richard 477
 
930 richard 478
// Read the "Domain allowed" file
913 richard 479
$tab=file(DOMAIN_ALLOWED_LIST);
480
if ($tab)  # the file isn't empty
481
	{
925 richard 482
	echo "<div id=\"authorized_domain\">$l_uam_domain";
913 richard 483
	foreach ($tab as $line)
484
		{
485
		if (trim($line) != '') # the line isn't empty
925 richard 486
			{
913 richard 487
			$domain_allowed=explode("#", $line);
925 richard 488
			if (trim($domain_allowed[1]) != ''){
489
				$domain=explode("\"", $domain_allowed[0]);
490
				echo "<a href=\"http://".trim($domain[1])."\">".trim($domain_allowed[1])."</a> ";}
491
			}	
913 richard 492
		}
493
	}
925 richard 494
echo "	
495
</div>
496
</center>
895 richard 497
</body>
498
</html>";
499
}
500
exit(0);
501
?>