Here is the version with a required email field.
The Email will also be checked for sql injection and then saved in the database.
But there isnt a check if a user with this email already exists.
PHP Code:
<body background="images/News_BG.gif">
<LINK REL="StyleSheet" HREF="style.css" TYPE="text/css">
<?PHP
include("Includes/config.php");
if ($Reg == Disabled) {
die("<center>Registration is currently disabled. Please contact the server administrator<br>or a Game Master.</center>");
}
?><center><u><b><font size=1>Registration at <?php echo "$Sname"; ?>.<br><br><br>
<table width="100" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<TABLE width="500" border="0" align="center" dwcopytype="CopyTableRow">
<FORM method=post name=regform action=Register.php?op=DoREG>
<TBODY>
<TR class="content">
<TD align=right valign="top"> <DIV align=left><font color="#FFFFFF">Login</DIV></TD>
<TD> <INPUT name=ps_loginname id="ps_loginname" class="lanyu" size=12 maxLength=10>
<B><font color="#FFFFFF">From 4 to 10 characters</B></TD>
</TR>
<TR class="content">
<TD valign="top"><font color="#FFFFFF">Password</TD>
<TD> <INPUT name=ps_password id="ps_password" type=password class="lanyu" size=12 maxLength=10>
<B><font color="#FFFFFF">From 4 to 10 characters</B></TD>
</TR>
<TR class="content">
<TD valign="top"><font color="#FFFFFF">Repeat Password</TD>
<TD> <INPUT name=ps_repassword type=password id="ps_repassword" class="lanyu"
size=12 maxLength=10> </TD>
</TR>
<TR class="content">
<TD valign="top"><font color="#FFFFFF">Email</TD>
<TD> <INPUT name=ps_email type=test id="ps_email" class="lanyu" size=12 maxLength=30> </TD>
</TR>
<tr align="center" class="content">
<TD colSpan=2><img src="images/reg.gif" class="hand" onClick="<?php print "$regsubmit"; ?>" > <img src="images/reset.gif" class="hand" onClick="regform.reset()"></TD>
</TR>
</form>
</table>
</font>
</td>
</table>
</div>
</body>
<?php
$op = stripslashes($_REQUEST['op']);
if ($op == DoREG)
{
//Start the registration procces ?>
<body bgcolor="#000000">
<LINK REL="StyleSheet" HREF="style.css" TYPE="text/css">
<body>
<?PHP
error_reporting(E_ALL ^ E_NOTICE);
include("Includes/config.php"); ?>
<table width="480" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<TABLE width="480" height=100% border=0 align=center cellPadding=5 cellSpacing=1>
<TBODY>
<TR class="content">
<TD colSpan=2 align=right> <div align="center" class="bigf Estilo5">
<?php
require 'Includes/config.php';
include_once('Includes/sql_check.php');
check_inject();
$msdb=mssql_select_db($ryl_db_auth,$msconnect);
$ps_loginname = stripslashes($_POST['ps_loginname']);
$ps_password = stripslashes($_POST['ps_password']);
$ps_repassword = stripslashes($_POST['ps_repassword']);
$ps_email = stripslashes($_POST['ps_email']);
if ((eregi("[^a-zA-Z0-9_-]", $ps_loginname)) || (eregi("[^a-zA-Z0-9_-]", $ps_name)) ||
(eregi("[^a-zA-Z0-9\.@_-]", $ps_email)) ||
(eregi("[^a-zA-Z0-9_-]", $ps_password)) ||
(eregi("[^a-zA-Z0-9_-]", $ps_repassword)) ||
(eregi("[^a-zA-Z0-9_-]", $ps_recquest)) ||
(eregi("[^a-zA-Z0-9_-]", $ps_recans)) )
{
echo("<font color='#FFFFFF'>SQL Injection Detected. Make sure to ONLY use letters (a-Z) and numbers (0-9)!");
exit();
}
$msdb=mssql_select_db($ryl_db_auth,$msconnect);
$sql_username_check = mssql_query("SELECT account FROM usertbl WHERE account='$ps_loginname'");
//$email_check = mssql_num_rows($sql_email_check);
$username_check = mssql_num_rows($sql_username_check);
if (empty($ps_loginname) || empty($ps_password) || empty($ps_repassword) || empty($ps_email)) {
echo "<font color='#FFFFFF'>Please fix the following error:<br />Some fields were left blank. Please go back and try again."; $Error=1;
$find_empty = array($ps_loginname,$ps_password,$ps_repassword,$ps_email);
$find_name = array('Login','Password','Confirm Password','Email');
$i=0;
foreach($find_empty as $fe){
if(empty($fe)){echo "<br>$find_name[$i] is empty";}
$i++;
}
}
elseif ($username_check > 0){
echo "Please fix the following errors: <br />";
if ($username_check > 0){
echo "<font color='#FFFFFF'>The username you have selected has already been used by another member
in our database. Please choose a different Username!<br />";
$Error=1;
}
}
elseif ($ps_password != $ps_repassword) {
echo "<font color=#FFFFFF>Please fix the following error:<br />The passwords you entered do not match."; $Error=1;
}
if ($Error!=1){
//$msquery2 = "SET uid_INSERT usertbl ON";
$msquery3 = "INSERT INTO usertbl (account,passwd,email) VALUES ('$ps_loginname','$ps_password','$ps_email')";
$msresults= mssql_query($msquery3);
?>
</div></TD>
</TR>
<div align="center">
<TR class="content"><TD height=2 colSpan=2 align=center><font color="#FFFFFF">Your account has been created succesfully:<br></TD></TR>
<TR class="content">
<TD width="88" align=right valign="top" > <DIV align=left><font color="#FFFFFF">Login:</DIV></TD>
<TD width="354"><B><font color="#FFFFFF"><?php print "$ps_loginname"; ?></B>
<DIV align=center></DIV></TD>
</TR>
<TR class="content">
<TD width="88" align=right valign="top"> <DIV align=left><font color="#FFFFFF">Password:</DIV></TD>
<TD width="354"><B><font color="#FFFFFF"><?php print "$ps_password"; ?></B>
<DIV align=center></DIV></TD>
</TR>
</TR>
</div>
</TABLE>
</td>
</tr>
</table>
</body>
<?php
}
?>
<?
}
?>