<?PHP
/*
 * newaccount.php - Author: Greg von Beck
 *
 * Copyright (C) 2001 PlaneShift Team (info@planeshift.it,
 * http://www.planeshift.it)
 *
 * 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 (version 2 of the License)
 * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Creation Date : 10/6/03
 * Description : This page accepts info for a new account.
 */
?>

<?include("start.php");?>

<?PHP include "db_setup.php"?>

<script language="javascript" src="validationLibrary.js">
</script>

<script language=javascript>
function validate()
{
    // realname should not be empty
    if(!isString(document.createaccount.realname, "Real Name", true))
    {
        return false;
    }
    //verify email is in the correct format and is not empty
    else if(!isEmail(document.createaccount.email, "E-Mail", true))
    {
        return false;
    }
    //verify that email and email2 are the same so that we know the 
    //e-mail is correct
    else if(document.createaccount.email.value != document.createaccount.email2.value)
    {
        alert("E-Mail fields do not match!");
	document.createaccount.email2.focus();
        return false;
    }
    return true;
}
</script>
<br>
<form name="createaccount" action="processnewaccount.php" method="post" onsubmit="return validate()">
<table>
<?PHP

if(isset($_GET['error']))
{
    if ($_GET['error'] == "email") {
      echo "<TR><TD colspan=2><FONT color=RED><B>The email you selected is already in use.  Please select another.</B></FONT></TD></TR>";

    } elseif($_GET['error'] == "username")
    {
        echo "<TR><TD colspan=2><font color=red><B>The E-Mail you entered is already associated with an account.</B></FONT></TD></TR>";
    }
}
?>

<TR><TD colspan=2>Accounts in PlaneShift are free of charge. No one will ask you money for the creation of an account or for ANY other service related to PlaneShift.<br> PlaneShift staff will never ask your password via email.<br><br></TD></TR>

    <TR>
        <TH align=right>Real Name: </TH>
	<TD><input name=realname maxlength=30></td>
    </TR>
    <TR>
        <TH align=right>E-Mail: </TH>
	<TD><input name=email maxlength=255></td>
    </TR>
    <TR>
        <TH align=right>Verify E-Mail: </TH>
	<TD><input name=email2 maxlength=255></td>
    </TR>
    <TR>
        <TD colspan=2><HR></TD>
    </TR>
    <TR>
        <TD colspan=2>
	    The following data is optional and 
	    will be used for statistical purposes.<BR>
	    <BR>
	</TD>
    <TR>
        <TH align=right>Country</TH>
	<TD><Select name=country>
	  <?
	  // Print the countries
	  include("settings.php");
	  PrintCountries();
	  ?>

	</TD>
    </TR>
    <TR>
        <TH align=right>Gender</TH>
	<TD><Select name=gender>
    <option value="Not Given"></option>
    <option>Male</option>
		<option>Female</option>
	</TD>
    </TR>
    <TR>
        <TH align=right>Age</TH>
	<TD><Select name=age>
    <option value="Not Given"></option>
    <option>0-10</option>
		<option>11-15</option>
		<option>16-20</option>
		<option>21-25</option>
		<option>26-30</option>
		<option>31-35</option>
		<option>36-40</option>
		<option>41-45</option>
		<option>46-50</option>
		<option>51-60</option>
		<option>61-70</option>
		<option>71-80</option>
		<option>80+</option>
	</TD>
    </TR>
    <TR>
        <TD colspan=2><HR></TD>
    </TR>
    <TR>
        <TD colspan=2>
	    When you click "Create Account" an e-mail will be<BR>
	    sent to your address with a link to verify your account.<BR>
	    Once you do this you will be able to set your password<BR>
	    and access the PlaneShift server.<BR>
	    <BR>
	</TD>
    </TR>
    <TR>
        <TD colspan="2" align="center"><input type="submit" value="Create Account"></TD>
    </TR>
</TABLE>
</FORM>


<?include("end.php");?>