<html><head>
<meta http-equiV="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<title>DACS Demonstration Login Page</title></head>
<body bgcolor="#fffff4">
<script type="text/javascript">
function jurisdiction_form_handler() {
  si = document.jurisdiction_form.DACS_JURISDICTION.selectedIndex;
  oo = document.jurisdiction_form.DACS_JURISDICTION.options[si];
  v = oo.value;

  s = v.split("@");
  h = s[0];
  oo.value = s[1];
  document.jurisdiction_form.action = h + "/dacs_authenticate";
  s[0] = "";
  s[1] = "";
  h = "";
}
</script>

<!-- Build a menu of jurisdictions using JavaScript and PHP -->
<!-- Call dacs_list_jurisdictions -->
<!-- This version takes optional USERNAME and DACS_JURISDICTION arguments -->
<!-- to select default values -->
<!-- Note: Replace "MYSERVER" with an appropriate domain name -->

<center>
<h1>Login for MyFederation</h1>
<hr>
</center>

<p>
<center>
<form name="jurisdiction_form" method="post" action="" onSubmit="jurisdiction_form_handler()">
<table width="100%">
<tr>
  <td width="20%"><font size="+1"><b>Home Jurisdiction</b></font></td>
  <td width="80%">
    <select name="DACS_JURISDICTION" size="1">
<?php
$file = fopen("https://MYSERVER/cgi-bin/dacs/dacs_list_jurisdictions?FORMAT=php", "r");
if (!$file) {
  echo "<p>Unable to open remote file.\n";
  exit;
}

$n = 0;
while (!feof($file)) {
  $line = rtrim(fgets($file, 1024));
  if ($line == "")
    continue;
  if ($line == "OK")
    break;
  parse_str($line);
  $n++;
}

fclose($file);

$selected = 0;
for ($i = 0; $i < $n; $i++) {
  if ($_REQUEST["DACS_JURISDICTION"] == $jurisdiction[$i]) {
    echo "<option value=\"$host[$i]\" selected>$jurisdiction[$i]</option>\n";
    $selected = 1;
  }
  else {
    echo "<option value=\"$host[$i]\">$jurisdiction[$i]</option>\n";
  }
}

if ($selected == 0) {
  echo('<option value="" selected>-&nbsp;-&nbsp;-&nbsp;-&nbsp;-&nbsp;-</option>');
}
?>
    </select>


</tr>
<tr>
  <td width="20%"><font size="+1"><b>Username</b></font></td>
  <td width="80%"><input type="TEXT" size=20 name="USERNAME"
<?php
if ($_REQUEST["USERNAME"] != "") {
  echo(" value=" . $_REQUEST["USERNAME"] . "></td>");
}
else {
  echo("</td>");
}
?>
</tr>

<tr>
  <td width="20%"><font size="+1"><b>Password</b></font></td>
  <td width="80%"><input type="PASSWORD" size="20" name="PASSWORD"></td>
</tr>

<tr>
 <td colspan="2">
 <pre>

 </pre>
 </td>
</tr>

<tr>
<td width="20%" align="LEFT"><input type="submit" value=" Login "></td>
<td align="LEFT"><input type="reset" value=" Reset all values "></td>
</tr>
<input type="hidden" name="DACS_BROWSER" value="1">
<input type="hidden" name="ENABLE_AUTH_HANDLERS" value="1">

</table>
</form>
</center>
<p>
<a hreF="https://MYSERVER/cgi-bin/dacs/dacs_current_credentials?DACS_VERSION=1.4&FORMAT=HTML">Show current credentials</a>
<p>
<a href="https://MYSERVER/cgi-bin/dacs/dacs_signout">Sign out</a>
<p>
<a href="https://MYSERVER/cgi-bin/dacs/dacs_list_jurisdictions?FORMAT=HTML">List jurisdictions</a>

<p>
<hr>
<p><em><b>Copyright (c) 2003-2011 Distributed Systems Software.  All rights reserved.</b></em>
<p>
<em><b>$Id: login2.php 2529 2011-09-23 22:19:51Z brachman $</b></em>
</body>
</html>
