<?php
/*
 * Registry/registration.php
 * 
 * Copyright 2009, 2017 Pedro Quaresma <pedro@mat.uc.pt>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */
require('../servidor.php');
require($entradaFILE.'dbLogin.php');


require($entradaFILE.'header.php');
require($entradaFILE.'menuHome.php');
?>



<center>
<h2>Registry</h2>
</center>


<?php
 // caso de uma segunda entrada para correcção de valores
if (isset($_GET)) {
  $vEmail          = $_GET['email'];
  $vUsername       = $_GET['username'];
  $vName           = $_GET['name'];
  $vAffiliation    = $_GET['affiliation'];
  $vURL            = $_GET['url'];
  $vType           = $_GET['type'];
  $vDateSubmission = $_GET['dateSubmission'];  
 }

$today=date('Y/m/d');

echo "<hr>\n";
echo "<form method='post' action='registerNew.php'>\n";
echo "  <table width='100%' bgcolor='white' cellpadding='4' cellspacing='4'>\n";
echo "  <tr>\n";
echo "<td colspan=4 align='center'>\n";
echo "  <span class='obrigatorio'>Mandatory data</span>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='right' width='25%' colspan='1'>\n";
echo "  <span class='obrigatorio'>Email address:</span>\n";
echo "  </td> \n";
echo "  <td align='left' width='75%' colspan='3'>\n";
echo "  <span class='entrada'>\n";
echo "  <input type='text' name='email' value='$vEmail' size=50 maxlength=100>\n";
echo "  </span>\n";
echo "  </td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "  <td align='right' width='25%' colspan='1'>\n";
echo "  <span class='obrigatorio'>Preferred username <br />(max 16 chars):\n";
echo "    </span>\n";
echo "  </td>\n";
echo "  <td valign='top' align='left' width='75%' colspan='3'>\n";
echo "  <span class='entrada'>\n";
echo "  <input type='text' name='username' value='$vUsername' size=16 maxlength=16>\n";
echo "  </span>\n";
echo "  </td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "  <td align='right' width='25%' colspan='1'>\n";
echo "  <span class='obrigatorio'>\n";
echo "  Password <br />(between 6 and 16 chars):\n";
echo "    </span>\n";
echo "  </td>\n";
echo "  <td valign='top' align='left' width='75%' colspan='3'>\n";
echo "  <span class='entrada'>\n";
echo "  <input type='password' name='passwd' size=16 maxlength=16>\n";
echo "  </span>\n";
echo "  </td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "  <td align='right' width='25%' colspan='1'>\n";
echo "  <span class='obrigatorio'>\n";
echo "  Confirm password:\n";
echo " </span>\n";
echo " </td>\n";
echo " <td valign='top' align='left' width='75%' colspan='3'>\n";
echo "  <span class='entrada'>\n";
echo "  <input type='password' name='passwd2' size=16 maxlength=16>\n";
echo "  </span>\n";
echo " </td>\n";
echo " </tr>\n";
echo " \n";
echo " </table>\n";
echo " <hr>\n";
echo " <table width='100%' bgcolor='white' cellpadding='4' cellspacing='4'>\n";
echo " <tr>\n";
echo " <td colspan=4 align='center'>\n";
echo "  <span class='ficha'>Optional data</span>\n";
echo " </td>\n";
echo " </tr>\n";
echo "  <tr>\n";
echo " <td align='right' width='25%' colspan='1'>\n";
echo "  <span class='ficha'>Name</span>\n";
echo " </td>\n";
echo " <td valign='top' align='left' width='75%' colspan='3'>\n";
echo "  <span class='entrada'>\n";
echo "  <input type='text' name='name' value='$vName' size=80 maxlength=100>\n";
echo "  </span>\n";
echo " </td>\n";
echo " </tr>\n";
echo "  <tr>\n";
echo " <td valign='top'  align='right' width='25%' colspan='1'>\n";
echo "  <span class='ficha'>Affiliation</span>\n";
echo " </td>\n";
echo " <td align='left' width='75%' colspan='3'>\n";
echo "  <TEXTAREA NAME='affiliation' ROWS='5' COLS='60'>$vAffiliation</TEXTAREA>\n";
echo " </td>\n";
echo " </tr>\n";
echo "\n";
echo " <td align='right' width='25%' colspan='1'>\n";
echo "  <span class='ficha'>URL</span>\n";
echo " </td>\n";
echo " <td align='left' width='75%' colspan='3'>\n";
echo "  <span class='entrada'>\n";
echo "  <input type='text' name='url' value='$vURL' size=80 maxlength=100>\n";
echo "  </span>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='right' width='25%' colspan='1'>\n";
echo "  <span class='ficha'>Regular User</span>\n";
echo " </td>\n";
echo " <td align='left' colspan='1'>\n";
echo "  <span class='entrada'>\n";
// Um novo utilizador é "Regular" a menos que explictamente queira 
// o contrário
//if ($vType=='Regular')
echo "  <input type='radio' name='type' value='Regular' checked>\n";
//else
//  echo "  <input type='radio' name='type' value='Regular'>\n";
echo "  </span>\n";
echo " </td> \n";
echo " <td>\n";
echo " <span class='entrada'>If you want only to browse through the data, and to experiment the interactive workbench.</span>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='right' width='25%' colspan='1'>\n";
echo "  <span class='ficha'>Contributer User</span>\n";
echo " </td>\n";
echo " <td align='left' colspan='1'>\n";
echo "  <span class='entrada'>\n";
if ($vType=='Contributer')
  echo "  <input type='radio' name='type' value='Contributer' checked>\n";
else
  echo "  <input type='radio' name='type' value='Contributer'>\n";
echo "  </span>\n";
echo " </td>\n";
echo " <td>\n";
echo " <span class='entrada'>If you want to contribute with new data. Subject to validation by the administrators.</span>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td colspan=4 align='center'>\n";
echo "  <input type='submit' value='Register'></td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " <input type='hidden' name='dateSubmission' value='$today'></td>\n";
echo " </form>\n";
?>

<?php
require($entradaFILE.'footer.php');
?>

