register.php
Code: Select all
<form action="/processregister.php" method="get">
<table width="455" cellpadding="0" cellspacing="0" border="0" class="header1">
<tr>
<th colspan="2" height="20" class="header2">User Info:</th>
</tr>
<tr>
<td valign="middle" width="163" class="header8"> Name:</td>
<td valign="middle" class="header8"><input maxlength="50" class="text3" type="text" name="name"></td>
</tr>
<tr>
<td valign="middle" width="163" class="header9"> Passwords:</td>
<td valign="middle" class="header9"><input maxlength="16" class="text3" type="password" name="pwd"></td>
</tr>
<tr>
<td valign="middle" width="163" class="header8"> Confirm Password:</td>
<td valign="middle" class="header8"><input maxlength="16" class="text3" type="password" name="pwd2"></td>
</tr>
<tr>
<td valign="middle" width="163" class="header9"> Email:</td>
<td valign="middle" class="header9"><input maxlength="55" class="text3" type="text" name="email"></td>
</tr>
<tr>
<th colspan="2" height="20" class="header2">About You:</th>
</tr>
<tr>
<td valign="middle" width="163" class="header8"> ICQ:</td>
<td valign="middle" class="header8"><input maxlength="40" class="text3" type="text" name="icq"></td>
</tr>
<tr>
<td valign="middle" width="163" class="header9"> AIM:</td>
<td valign="middle" class="header9"><input maxlength="40" class="text3" type="text" name="aim"></td>
</tr>
<tr>
<td valign="middle" width="163" class="header8"> MSN:</td>
<td valign="middle" class="header8"><input maxlength="40" class="text3" type="text" name="msn"></td></tr>
</tr>
<tr>
<td valign="middle" width="163" class="header9"> Yahoo!:</td>
<td valign="middle" class="header9"><input maxlength="40" class="text3" type="text" name="yahoo"></td>
</tr>
<tr>
<td valign="middle" width="163" class="header8"> Website:</td>
<td valign="middle" class="header8"><input maxlength="55" class="text3" type="text" name="website"></td>
</tr>
<tr>
<td valign="middle" width="163" class="header9"> Location:</td>
<td valign="middle" class="header9"><input maxlength="55" class="text3" type="text" name="location"></td>
</tr>
<tr>
<td valign="middle" width="163" class="header8"> Intrists:</td>
<td valign="middle" class="header8"><input maxlength="55" class="text3" type="text" name="intrists"></td>
</tr>
<tr>
<th colspan="2" height="20" class="header2" style="border-bottom: 1px solid black;"><input class="text3" type="submit" name="Register!"></th>
</tr>
</table>
</form>Code: Select all
<?PHP
$name=$HTTP_POST_VARS['name'];
$pwd=$HTTP_POST_VARS['pwd'];
$pwd2=$HTTP_POST_VARS['pwd2'];
$email=$HTTP_POST_VARS['email'];
$icq=$HTTP_POST_VARS['icq'];
$aim=$HTTP_POST_VARS['aim'];
$msn=$HTTP_POST_VARS['msn'];
$yahoo=$HTTP_POST_VARS['yahoo'];
$website=$HTTP_POST_VARS['website'];
$location=$HTTP_POST_VARS['location'];
$intrists=$HTTP_POST_VARS['intrists'];
$dbh=mysql_connect ("localhost", "root", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
include('/header.php');
if ($name='')
{
echo '<p class="text">You did not fill out all the necessary fields, please go back and enter in a name.</p>';
include('/footer.php');
exit;
}
if ($pwd='')
{
echo '<p class="text">You did not fill out all the necessary fields, please go back and enter in a password.</p>';
include('/footer.php');
exit;
}
if ($pwd2='')
{
echo '<p class="text">You did not fill out all the necessary fields, please go back and enter in a password.</p>';
include('/footer.php');
exit;
}
if ($email='')
{
echo '<p class="text">You did not fill out all the necessary fields, please go back and enter in a email.</p>';
include('/footer.php');
exit;
}
if ($pwd != $pwd2)
{
echo '<p class="text">Sorry the passwords didnt match, please go back and try again.</p>';
include('/footer.php');
exit;
}
$dbquery = mysql_query("INSERT INTO `users` ( `name`, `password`, `email`, `icq`, `aim`, `msn`, `yahoo`, `website`, `location`, `intrists`) VALUES ($name, $pwd, $email, $icq, $aim, $msn, $yahoo, $website, $location, $intrists )");
echo '<p class="text">Thank you for registering, $name !</p>';
include('/footer.php');
?>