Subversion Repositories ALCASAR

Rev

Rev 475 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 475 Rev 484
Line 26... Line 26...
26
 
26
 
27
# Shared secret used to encrypt challenge with radius.
27
# Shared secret used to encrypt challenge with radius.
28
$uamsecret = "Mkb0pAEE";
28
$uamsecret = "Mkb0pAEE";
29
 
29
 
30
# URL loaded after success authenticates (let blank for browser defaults)
30
# URL loaded after success authenticates (let blank for browser defaults)
31
$adminurl = "";
31
$adminurl = "http://www.sfr.fr";
32
 
32
 
33
# Our own path
33
# Our own path
34
$loginpath = $_SERVER['PHP_SELF'];
34
$loginpath	= $_SERVER['PHP_SELF'];
35
$statuspath = "http://alcasar/status.php";
35
$statuspath = "http://alcasar/status.php";
-
 
36
$debug		= true;
36
 
37
 
37
# Choice of language
38
# Choice of language
38
$Language = 'en';
39
$Language = 'en';
39
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
40
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
40
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
41
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
Line 324... Line 325...
324
  default: $result = 0; // Default: It was not a form request
325
  default: $result = 0; // Default: It was not a form request
325
}
326
}
326
 
327
 
327
# Otherwise it was not a form request
328
# Otherwise it was not a form request
328
# Send out an error message
329
# Send out an error message
329
if ($result == 0) {
330
if ($result == 0) {	//erreur
330
    echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
331
    echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
331
<html>
332
<html>
332
<head>
333
<head>
333
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
334
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
334
  <title>$R_loginfailed</title>
335
  <title>$R_loginfailed</title>
Line 351... Line 352...
351
<head>
352
<head>
352
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
353
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
353
  <title>$R_loggingin</title>
354
  <title>$R_loggingin</title>
354
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
355
  <meta http-equiv=\"Cache-control\" content=\"no-cache\">
355
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
356
  <meta http-equiv=\"Pragma\" content=\"no-cache\">
356
  <SCRIPT LANGUAGE=\"JavaScript\">
357
  <script type=\"text/javascript\" language=\"JavaScript\">
357
    var blur = 0;
358
    var blur = 0; // not un use
358
    var starttime = new Date();
-
 
359
    var startclock = starttime.getTime();
-
 
360
    var mytimeleft = 0;
359
	var mytimeleft = 0; // not un use
361
 
-
 
362
    function doTime() {
-
 
363
      window.setTimeout( \"doTime()\", 1000 );
-
 
364
      t = new Date();
-
 
365
      time = Math.round((t.getTime() - starttime.getTime())/1000);
-
 
366
      if (mytimeleft) {
-
 
367
        time = mytimeleft - time;
-
 
368
        if (time <= 0) {
-
 
369
          window.location = \"$statuspath?res=popup3&uamip=$uamip&uamport=$uamport\";
-
 
370
        }
-
 
371
      }
-
 
372
      if (time < 0) time = 0;
-
 
373
      hours = (time - (time % 3600)) / 3600;
-
 
374
      time = time - (hours * 3600);
-
 
375
      mins = (time - (time % 60)) / 60;
-
 
376
      secs = time - (mins * 60);
-
 
377
      if (hours < 10) hours = \"0\" + hours;
-
 
378
      if (mins < 10) mins = \"0\" + mins;
-
 
379
      if (secs < 10) secs = \"0\" + secs;
-
 
380
      title = \"$R_online_time : \" + hours + \":\" + mins + \":\" + secs;
-
 
381
      if (mytimeleft) {
-
 
382
        title = \"$R_remaining_time : \" + hours + \":\" + mins + \":\" + secs;
-
 
383
      }
-
 
384
      if(document.all || document.getElementById){
-
 
385
         document.title = title;
-
 
386
      }
-
 
387
      else {   
-
 
388
        self.status = title;
360
	alcasar_popup = null;
389
      }
-
 
390
    }
-
 
391
 
361
	
392
    function popUp(URL) {
362
    function popUp(URL) {
393
      if (self.name != \"chillispot_popup\") {
363
      if (self.name != \"alcasar_popup\") {
394
        chillispot_popup = window.open(URL, 'chillispot_popup', 'width=500,height=250,resizable,scrollbars=yes,location=yes,toolbar=no,statusbar=no,menubar=no');
364
        alcasar_popup = window.open(URL, 'alcasar_popup', 'width=500,height=250,directories=no,resizable=no,scrollbars=yes,location=no,toolbar=no,statusbar=no,menubar=no');
395
      }
365
      }
396
    }
366
    }
397
 
367
 
398
    function doOnLoad(result, URL, userurl, redirurl, timeleft) {
368
    function doOnLoad(result, userurl, redirurl, timeleft) {    
399
	URL = \"$statuspath\";	    
-
 
400
      if (timeleft) {
369
      if (timeleft) { // not in use
401
        mytimeleft = timeleft;
370
        mytimeleft = timeleft;
402
      }
371
      }
403
      if ((result == 1) && (self.name == \"chillispot_popup\")) {
-
 
404
	      doTime();
-
 
405
	      window.onbeforeunload = DecO($result);
-
 
406
      }
-
 
407
      if ((result == 1) && (self.name != \"chillispot_popup\")) {
372
      if (result == 1) {	//success
408
	      // popUp(URL);
-
 
409
	      window.location = userurl;
373
	      //window.location = userurl;
410
      }
-
 
411
      if ((result == 2) || result == 5) {
-
 
412
        document.form1.UserName.focus()
374
		  if (alcasar_popup != null) alcasar_popup.focus();
413
      }
-
 
414
      if ((result == 2) && (self.name != \"chillispot_popup\")) {
-
 
415
	popUp();
-
 
416
        chillispot_popup.close();
-
 
417
      }
-
 
418
      if ((result == 12) && (self.name == \"chillispot_popup\")) {
-
 
419
	doTime();
-
 
420
	";
375
		  ";
421
if ($adminurl) { echo "opener.location = \"$adminurl\";";}
376
if ($adminurl) { echo "window.location = \"$adminurl\";";}
422
else if	($redirurl) { echo "opener.location = \"$redirurl\";";}
377
else if	($redirurl) { echo "window.location = \"$redirurl\";";}
423
else if ($userurl) { echo "opener.location = \"$userurl\";";}
378
else if ($userurl) { echo "window.location = \"$userurl\";";}
424
else echo "opener.home();";
379
else echo "window.home();";
425
        echo "
380
        echo "
426
        self.focus();
-
 
427
        blur = 0;
-
 
428
      }
381
      }
429
      if ((result == 13) && (self.name == \"chillispot_popup\")) {
382
      if ((result == 2) || (result == 3) || result == 5) { //failed or logoff or notyet
430
        self.focus();
383
		if (alcasar_popup != null) alcasar_popup.close();
431
        blur = 1;
384
		document.form1.UserName.focus();
432
      }
385
      }
433
    }
386
    }
434
 
-
 
435
    function DecO(result) {
-
 
436
      if ((result == 12) && (self.name == \"chillispot_popup\")) {
-
 
437
        window.location = \"http://$uamip:$uamport/logoff \";
-
 
438
	self.focus();
-
 
439
	blur = 1;
-
 
440
	//alert ('$R_loggedout');
-
 
441
	}
-
 
442
     }
-
 
443
  </script>
387
  </script>
444
<link rel=\"stylesheet\" href=\"/css/style_intercept.css\" type=\"text/css\">
388
<link rel=\"stylesheet\" href=\"/css/style_intercept.css\" type=\"text/css\">
445
</head>
389
</head>
446
<body onLoad=\"javascript:doOnLoad($result,'$loginpath?res=popup2&uamip=$uamip&uamport=$uamport&userurl=$userurl&redirurl=$redirurl&timeleft=$timeleft','$userurl','$redirurl','$timeleft')\" OnbeforeUnload=\"javascript:DecO($result)\">
390
<body onLoad=\"javascript:doOnLoad($result,'$userurl','$redirurl','$timeleft')\">
447
  <center>";
391
  <center>";
448
#Modifications par stephane ERARD le 30 11 2010
392
#Modifications par stephane ERARD le 30 11 2010
449
	
-
 
-
 
393
#Modifications par steweb57 le 06 02 2011
450
	
394
if ($debug){
451
# begin debugging
395
# begin debugging
452
#  print "<center>THE INPUT by GET method (for debugging):<br>";
396
	print "<center>THE INPUT by GET method (for debugging):<br>";
453
#  foreach ($_GET as $key => $value) {
397
	foreach ($_GET as $key => $value) {
454
#    print $key . "=" . $value . "<br>";
398
		print $key . "=" . $value . "<br>";
455
#  }
399
	}
456
#  print "<br>";
400
	print "<br>";
457
#  print "<center>THE INPUT by POST method (for debugging):<br>";
401
	print "<center>THE INPUT by POST method (for debugging):<br>";
458
#  foreach ($_POST as $key => $value) {
402
	foreach ($_POST as $key => $value) {
459
#    print $key . "=" . $value . "<br>";
403
		print $key . "=" . $value . "<br>";
460
#  }
404
	}
461
#  print "<br></center>";
405
	print "<br></center>";
462
# end debugging
406
# end debugging
-
 
407
}
463
 
408
 
464
if ($result == 2) {
409
if ($result == 2) { //failed
465
    echo "
410
    echo "
466
	<DIV id=\"logon\">
411
	<DIV id=\"logon\">
467
	<h2>$R_loginfailed</h2>";
412
	<h2>$R_loginfailed</h2>";
468
    if ($reply) {
413
    if ($reply) {
469
#traitement du reply ...
414
#traitement du reply ...
470
    echo "<center> $reply </BR></BR></center>";
415
    echo "<center> $reply </BR></BR></center>";
471
    }
416
    }
472
}
417
}
473
 
418
 
474
if ($result == 5) {
419
if ($result == 3 || $result == 5) { //logoff or notyet
475
    echo "
420
    echo "
476
	<DIV id=\"logon\">
421
	<DIV id=\"logon\">
477
	<h1>$organisme</h1>
422
	<h1>$organisme</h1>
478
	<h2>$R_loggedcont</h2>";
423
	<h2>$R_loggedcont</h2>";
479
}
424
}
480
 
425
  
481
if ($result == 2 || $result == 5) {
426
if ($result == 2 || $result == 3 || $result == 5) { //failed or logoff or notyet
482
  echo "
427
  echo "
483
	<IMG id=\"logo-alcasar\" src=\"/images/logo-alcasar.png\">
428
	<IMG id=\"logo-alcasar\" src=\"/images/logo-alcasar.png\">
484
	<form name=\"form1\" method=\"post\" action=\"$loginpath\">
429
	<form name=\"form1\" method=\"post\" action=\"$loginpath\">
485
	<input type=\"hidden\" name=\"challenge\" value=\"$challenge\">
430
	<input type=\"hidden\" name=\"challenge\" value=\"$challenge\">
486
	<input type=\"hidden\" name=\"uamip\" value=\"$uamip\">
431
	<input type=\"hidden\" name=\"uamip\" value=\"$uamip\">
Line 495... Line 440...
495
			<TR>
440
			<TR>
496
				<TD align=\"right\">$R_password</TD>
441
				<TD align=\"right\">$R_password</TD>
497
				<TD align=\"left\"><INPUT maxLength=\"32\" type=\"password\" name=\"Password\"></TD>
442
				<TD align=\"left\"><INPUT maxLength=\"32\" type=\"password\" name=\"Password\"></TD>
498
			</TR>
443
			</TR>
499
			<TR>
444
			<TR>
500
				<TD height=\"23\" colSpan=\"2\" align=\"middle\"><INPUT value=\"$R_boutonO\" type=\"submit\" name=\"button\" onclick=\"javascript:popUp('$statuspath')\"></TD>
445
				<TD height=\"23\" colSpan=\"2\" align=\"center\"><INPUT value=\"$R_boutonO\" type=\"submit\" name=\"button\" onclick=\"javascript:popUp('$statuspath')\"></TD>
501
			</TR>
446
			</TR>
502
			<TR>
447
			<TR>
503
				<TD colSpan=2 align=middle><H6><A href=\"https://$uamip/pass/\">$R_passwordchg</A></H6></TD>
448
				<TD colSpan=2 align=center><H6><A href=\"https://$uamip/pass/\">$R_passwordchg</A></H6></TD>
504
			</TR>
449
			</TR>
505
		</TABLE>
450
		</TABLE>
506
		<TABLE id=\"boite-info\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\">
451
		<TABLE id=\"boite-info\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\">
507
			<TR>
452
			<TR>
508
				<TD align=\"middle\"><FONT color=\"red\"><B>$R_loggedin_stringl0</B></FONT></TD>
453
				<TD align=\"center\"><FONT color=\"red\"><B>$R_loggedin_stringl0</B></FONT></TD>
509
			</TR>
454
			</TR>
510
			<TR>
455
			<TR>
511
				<TD align=\"middle\"><FONT color=\"black\"><B>$R_loggedin_stringl1</B></FONT></TD>
456
				<TD align=\"center\"><FONT color=\"black\"><B>$R_loggedin_stringl1</B></FONT></TD>
512
			</TR>
457
			</TR>
513
			<TR>
458
			<TR>
514
				<TD align=\"left\">
459
				<TD align=\"left\">
515
					<UL>
460
					<UL>
516
						<LI>$R_loggedin_stringl2</LI>
461
						<LI>$R_loggedin_stringl2</LI>
Line 522... Line 467...
522
					$R_ca_1 <A href=\"/certs/certificat_alcasar_ca.crt\">$R_ca_2</a> $R_ca_3 <a href=\"/alcasar-certificat.pdf\">$R_ca_4</A> 
467
					$R_ca_1 <A href=\"/certs/certificat_alcasar_ca.crt\">$R_ca_2</a> $R_ca_3 <a href=\"/alcasar-certificat.pdf\">$R_ca_4</A> 
523
					</P>
468
					</P>
524
				</TD>
469
				</TD>
525
			</TR>
470
			</TR>
526
		</TABLE>
471
		</TABLE>
527
	</DIV>
472
	
528
  </center>
473
  </center>
529
  </form>
474
  </form>
-
 
475
  </DIV>
530
</body>
476
</body>
531
</html>";
477
</html>";
532
}
478
}
533
#Fin des modifications
479
#Fin des modifications
534
if ($result == 1) {
480
if ($result == 1) { //sucess
535
  echo "
481
  echo "
536
  <table id=\"auth_reussi\">
482
  <table id=\"auth_reussi\">
537
  <tr>
483
  <tr>
538
  <td>
484
  <td>
539
  <img height=\"150\" src=\"/images/logo-alcasar.png\">
485
  <img height=\"150\" src=\"/images/logo-alcasar.png\">
540
  </td>
486
  </td>
541
  <td>
487
  <td>
542
  <p class=\"text_auth\">$R_login</p>
488
  <p class=\"text_auth\">$R_login</p>
543
  </td>
489
  </td>
-
 
490
  </tr>
-
 
491
  <tr>
-
 
492
  <td></td>
544
  </tr>";
493
  <td>";
545
  if ($reply) { 
494
  if ($reply) { 
546
 ## traitement reply
495
 ## traitement reply
547
     echo "<center> $reply </br></br></center>";
496
     echo "$reply</br></br>";
548
  }
497
  }
549
  echo "
498
  echo "
550
  <center>
-
 
551
    <a href=\"http://$uamip:$uamport/logoff\">$R_logout</a>
499
  <a href=\"http://$uamip:$uamport/logoff\">$R_logout</a>
552
  </center>
-
 
553
</body>
-
 
554
</html>";
-
 
555
}
-
 
556
 
-
 
557
if (($result == 4) || ($result == 12)) {
-
 
558
  echo "
-
 
559
  <table id=\"auth_reussi\">
-
 
560
  <tr>
-
 
561
  <td>
-
 
562
  <img height=\"150\" src=\"/images/logo-alcasar.png\">
-
 
563
  </td>
-
 
564
  <td>
-
 
565
  <p class=\"text_auth\">$R_login</p>
-
 
566
  </td>
500
  </td>
567
  </tr>
501
  </tr>
568
  <tr><td colspan=2><center>
-
 
569
    <p class=\"lien_deco\"><a href=\"http://$uamip:$uamport/logoff\">$R_logout</a></p>
-
 
570
  </center></td></tr>
-
 
571
  </table>
502
  </table>
572
  </body>
-
 
573
  </html>";
-
 
574
}
-
 
575
 
-
 
576
if ($result == 11) {
-
 
577
  echo "
-
 
578
  <h2 style=\"text-align: center;\">$R_loggingin</h2>
-
 
579
  <center>$R_wait</center>
-
 
580
</body>
503
</body>
581
</html>";
504
</html>";
582
}
505
}
583
 
-
 
584
if (($result == 3) || ($result == 13)) {
506
if ($result == 11) { //popup 1 (login)
585
  echo "
507
  echo "
586
  <center>
-
 
587
  <p class=\"log_out\">$R_loggedout</p>
508
  <h2 style=\"text-align: center;\">$R_loggingin</h2>
588
  <FORM>
-
 
589
  <INPUT TYPE=\"button\" VALUE=\"$R_boutonF\" onClick=\"window.close()\">
-
 
590
  </FORM></CENTER>
509
  <center>$R_wait</center>
591
</body>
510
</body>
592
</html>";
511
</html>";
593
}
512
}
594
 
-
 
595
exit(0);
513
exit(0);
596
?>
514
?>