Provo con questo altrimenti dovreste darmi qualche indicazione :(
Codice PHP:
<?php include ("../site_includes/gamengdb.php"); ?>
<html>
<head><title>New Member Registeration Page</title>
</head>
<body>
<?php
if ($_POST[submit]=="Register")
{
/* Check that username is at 4 characters long, change if you desire more or less, max for field is 32 */
if (strlen(trim($log_name)) < 4 )
{ echo "<center><strong><p class='error'>Username must be at least four characters.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check for duplicate name, this includes Player and Character names. */
$sql="SELECT log_name FROM game_data WHERE log_name='$log_name'";
$result=mysql_query($sql) or die ("Unable to get member names.<br>'.mysql_error().'<br>");
$num=mysql_numrows($result);
if ($num>0)
{ echo "<center><strong><p class='error'>Name already in use please try another.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check for password */
if ($fpassword =="")
{ echo "<center><strong><p class='error'>You must enter a password.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check that password is at least 5 characters long, change if you desire more or less, max for field is 32 */
if (strlen(trim($fpassword)) < 5 )
{ echo "<center><strong><p class='error'>Password must be at least five characters.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check that password and confirmed password match */
if ($fpassword != $confirmpw)
{ echo "<center><strong><p class='error'>Password and retype password do not match.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check for age */
if ($user_age =="")
{ echo "<center><strong><p class='error'>You must enter your age.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check for min age, set to 18 years old, if you desire younger change. */
if ($user_age < "18")
{ echo "<center><strong><p class='error'>You must must be at least 18 to join.</p><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check for email address */
if ($email =="")
{ echo "<center><strong><p class='error'>You must enter an e-mail address.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check for correct email format, correct format is ?????@???.??? or ?????@???.?? */
if (!ereg('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$', $email))
{ echo "<center><strong><p class='error'>E-mail address format is not valid.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check for duplicate email, if you do not care, remove this section */
$sql="SELECT email FROM game_data WHERE email='$email'";
$result=mysql_query($sql) or die ("Unable to get member email.<br>'.mysql_error().'<br>");
$num=mysql_numrows($result);
if ($num>0)
{ echo "<center><strong><p class='error'>Email already in use please use another.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
/* Check for acceptance */
if ($accept_tos != "Yes")
{ echo "<center><strong><p class='error'>You must agree to the terms and conditions of use.</p></strong><p><a href='javascript:history.back()'>Try Again</a></p></center>";
$_POST=NULL;
exit();
}
else
$query="INSERT INTO game_data
(log_name,date_joined,account_type,password,email,show_email,time_zone,alt_contact,user_age,gender,web_site,comments,char_type) VALUE (\"$_POST[log_name]\",NOW(),\"$_POST[account_type]\",\"$_POST[fpassword]\",\"$_POST[email]\",\"$_POST[show_email]\",\"$_POST[time_zone]\",\"$_POST[alt_contact]\",\"$_POST[user_age]\",\"$_POST[gender]\",\"$_POST[web_site]\",\"$_POST[comments]\",\"$_POST[char_type]\")";
$result = mysql_query($query) or die("Couldn't add user.<br>".mysql_error()."<br>");
echo "<br><center><p>Welcome to the game $log_name,<br> records/*
else
{
?>
<form action="<?=$PHP_SELF?>" method="POST">
<input name="account_type" type="hidden" value="Player">
<input name="char_type" type="hidden" value="">
<table width="525" border="0" align="center">
<tr>
<td align="right"><strong><p>User Name</p></strong></td>
<td><input type="text" name="log_name" id="log_name" size="32" maxlength="32" class="form"></td>
<td><small><p>(Min 4 Characters)</p></small></td>
</tr>
<tr><td align="right"><strong><p>Password</p></strong></td>
<td><input type="password" name="fpassword" id="fpassword" size="32" maxlength="32" class="form"></td>
<td><small><p>(Min 5 Characters)</p></small></td>
</tr>
<tr>
<td align="right"><strong><p>Retype Password</p></strong></td>
<td><input type="password" name="confirmpw" id="confirmpw" size="32" maxlength="32" class="form"></td>
<td> </td>
</tr>
<tr><td align="right"><strong><p>E-Mail</p></strong></td>
<td><input type="text" name="email" id="email" size="32" maxlength="128" class="form"></td>
<td><small><p>(Enter in lowercase)</p></small></td>
</tr>
<tr>
<td align="right"><strong><p>Show E-Mail</p></strong></td>
<td>
<select name="show_email" id="show_email" class="form">
<option value="Yes" selected>Yes</option>
<option value="No">No</option>
</select></td>
<td><small><p>(Visible to non-staff?)</p></small></td>
</tr>
<tr><td align="right"><strong><p>Age</p></strong></td>
<td><input type="text" name="user_age" id="user_age" size="1" maxlength="2" class="form"></td>
<td> </td>
</tr>
<tr>
<td colspan="3"><div align="center"><hr width="75%"></div></td>
</tr>
<tr>
<td align="right"><strong><p>Gender</p></strong></td>
<td>
<select name="gender" id="gender" class="form">
<option value="" selected></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select> </td>
<td> </td>
</tr>
<tr>
<td align="right"><strong><p>Time Zone</p></strong> </td>
<td><select name="time_zone" id="time_zone" class="form">
<option value="GMT -12 Hours">GMT -12 Hours</option>
</select></td>
<td> </td>
</tr>
<tr>
<td align="right"><strong><p>AIM/MSN/YM</p></strong> </td>
<td><input type="text" name="alt_contact" id="alt_contact" size="32" maxlength="128" class="form"></td>
<td> </td>
</tr>
<tr>
<td align="right"><strong><p>Website</p></strong> </td>
<td><input type="text" name="web_site" id="web_site" size="32" maxlength="128" class="form"></td>
<td> </td>
</tr>
<tr>
<td align="right"><strong><p>Comments</p></strong></td>
<td><input type="text" name="comments" id="comments" size="32" maxlength="255" class="form"></td>
<td> </td>
</tr>
<tr>
<td colspan="3"><div align="center"><hr width="75%"></div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><p>Do you accept the to the <a href="#">terms and conditions of use</a>?</p></div></td>
<td><select name="accept_tos" id="accept_tos" class="form">
<option value="Yes">Yes</option>
<option value="No" selected>No</option>
</select></td>
</tr>
<tr>
<td colspan="3"><div align="center"><hr width="75%"></div></td>
</tr>
<tr><td> </td>
<td align="center"><input type="submit" name="submit" value="Register" class="form"></td>
<td align="center"> </td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>