<?php
  // Time-stamp: <mark 2010-05-20 04:00:26>
  include "./config.php";
  include INCPATH."/template_functions.php";

  //$identifier=uniqid();
  $identifier=rand();
  $upload_id=1;

  header('Content-type: text/html;charset=utf8');	
  session_start();
  get_header();
?>
<?php
$user_name="";

if (isset($_GET['reset'])) {
  foreach ($_SESSION as $key => $dumb_value)
    unset($_SESSION[$key]);
  $user_name="anonymous";
}
else {  
  if (isset($_GET['user_name']) && $_GET['user_name']!==""){
    $_SESSION['user_name']=$_GET['user_name'];  
  }

  if (isset($_SESSION['user_name'])){
    $user_name=$_SESSION['user_name'];  
  }
  else {
    $user_name="anonymous";
  }
}
?>

<div id="content">

<fieldset style="width: 600px;">
<legend><b>Instructions</b></legend>
  <p style='padding: 10px;'>1. Please register a user name <b>before</b> you use each time.</p>
  <p style='padding: 10px;'>2. You can register the <b>same</b> user name at each time.</p>
  <p style='padding: 10px;'>3. Users can <b>only</b> access the jobs they submitted. So please remember the user name you used in order to get the results in the <i>Progress Monitor</i> page</p>
</fieldset>

<br/>
<br/>

<fieldset style="width: 600px;">
<legend><b>Registration</b></legend>
<table>
  <tbody>
    <tr>
      <td>Current User Name:</td>
      <td>             
        <form action='./register.php' method='get'>
          <input type="text" id="user_name" size='10' maxlength='10' value="<?php echo $user_name;?>" readonly/>
          <input type="submit" style="width:100px" name='reset' value="Reset"/>
        </form>
      </td>
    </tr>
    <tr>
      <td>New User name:</td>
      <td>
        <form action='./register.php' method='get'>
          <input type="text" id="user_name" size='10' maxlength='10' name='user_name' value=""/>
          <input type="submit" style="width:100px" value="Register"/>
        </form>
      </td>
    </tr>
  </tbody>
</table>
</fieldset>

<!--
<fieldset style="width: 600px;">
  <legend><b>Debug</b></legend>
<?php
/*
echo "Session:";
echo htmlspecialchars(print_r($_SESSION,true));
echo "<br/>Get:";
echo htmlspecialchars(print_r($_GET,true));
echo "<br/>Post:";
echo htmlspecialchars(print_r($_POST,true));
*/
?>
</fieldset>
-->

</div>
<!-- end of <div id="content"> -->



<?php
   get_sidebar(2);
   get_footer();
   flush();
?>
