alanzhao
after registration send them to that page?
no see i have 2 pages for signup signup.php and register.php
signup is just the form once they hit submit it goes directly to to register.php and checks everything to make sure everything is find and then stores the data..
signup.php
<form name="form" method="post" action="/index.php?pages=register">
<table border="0" align="center" cellpadding="4" cellspacing="0" bordercolor="#000000">
<tr>
<td width="163"> <div align="right">-</div></td>
<td width="217" nowrap> <div align="left" class="h">Compulsory Information</div></td>
</tr>
<tr>
<td> <div align="right" class="txt">User Name:</div></td>
<td nowrap><span class="txt"><input name="user_name" type="text" id="user_name" class="input-box" value="<? echo $user_name; ?>">
<?php
if (!$user_name) {
echo '*';
}
if ($username_check > 0) {
echo '<font class="txt">* Your choice of Username has already been registered in our database. Please submit a different Username</font>';
unset($user_name);
}
?>
</span>
</td>
</tr>
<tr>
<td> <div align="right" class="txt">Email Address:</div></td>
<td width="217" nowrap><span class="txt"><input name="email_address" type="text" id="email_address" class="input-box" value="<? echo $email_address; ?>">
<?php
if (!$email_address) {
echo '*';
}
if ($email_check > 0) {
echo '<font class="txt">* Your Email Address has already been registered in our database. Please submit a different Email Address</font>';
unset($email_address);
}
?>
</span>
</td>
</tr>
<tr>
<td><div align="right" class="txt">Re TypeEmail Address:</div></td>
<td width="217" nowrap><span class="txt"><input name="email_address2" type="text" id="email_address2" class="input-box" value="<? echo $email_address2; ?>">
<?php
if (!$email_address2) {
echo '*';
}
if (($email_address) != ($email_address2)) {
echo '<font class="txt">* Email addresses dont match</font>';
unset($email_address2);
}
?>
</span>
</td>
</tr>
<tr>
<td><div align="right" class="txt">Desired Password:</div></td>
<td nowrap><span class="txt"><input name="password" type="password" id="password" class="input-box" value="<? echo $password; ?>">
<?php
if (!$password) {
echo '*';
}
?>
</span>
</td>
</tr>
<tr>
<td><div align="right" class="txt">Desired Race:</div></td>
<td nowrap><span class="txt">
<select name="race" class="select">
<option value="">Select a Race</option>
<?php
$sql = "SELECT * FROM race ORDER BY id";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$race = $row['race'];
?>
<option value="<?php echo $row['race']; ?>"><?php echo $row['race']; ?></option>
<?php
}
?>
</select>
</span>
</td>
</tr>
<tr>
<td><?php print ("<input type=\"hidden\" name=\"ip\" value=\"{$_SERVER['REMOTE_ADDR']}\">"); ?></td>
<td nowrap> <p align="right"><span><input type="submit" name="Submit" value="Join Now" class="submit-button"></span></p></td>
</tr>
</table>
</form>
register.php
<?
$user_name = $_POST['user_name'];
$password = $_POST['password'];
$email_address = $_POST['email_address'];
$email_address2 = $_POST['email_address2'];
$race = $_POST['race'];
$hp = $_POST['hp'];
$hp = $_POST['max_hp'];
$ip = $_POST['ip'];
if ((!$user_name) || (!$email_address) || (!$email_address2) || (!$password)) {
echo '<br><center><font class="h"><b>Error!</b> Fields marked * are required to signup.</font></center><br><br>';
include 'join_form.php';
return;
}
if (($email_address) != ($email_address2)) {
echo '<br><center><font class="h"><b>Error!</b> Fields marked * are required to signup.</font></center><br><br>';
include 'join_form.php';
return;
}
$sql_email_check = mysql_query("SELECT email_address FROM users WHERE email_address='$email_address'");
$sql_username_check = mysql_query("SELECT user_name FROM users WHERE user_name='$user_name'");
$email_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);
if (($email_check > 0) || ($username_check > 0)) {
echo '<font class="h" color="#FF0000"><b>Error!</b></font> <font class="txt">Please fix the following errors:</font><br>';
include 'join_form.php';
return;
}
$sql_ip_check = mysql_query("SELECT ip FROM users WHERE ip='$ip'");
$sql_username_check = mysql_query("SELECT user_name FROM users WHERE user_name='$user_name'");
$ip_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);
if (($ip_check > 0) || ($username_check > 0)) {
echo '<font class="h" color="#FF0000"><b>Error!</b></font> <font class="txt">Please fix the following errors:</font><br>';
include 'join_form.php';
return;
}
$sql = mysql_query("INSERT INTO users (user_name, email_address, password, race, signup_date, ip)
VALUES('$user_name', '$email_address', '$password', '$show_email', '$race', now(), '$ip')") or die (mysql_error());
if (!$sql) {
echo '<center><font class="h">There has been an error creating your account. Please contact the webmaster.</font></center>';
} else {
$userid = mysql_insert_id();
// Change these values to suit --------------------------------------
$site_name = "Kwallen-Islands";
$replyto = "admin<admin@kwallen-islands.890m.com/>";
$adminemail = "admin@kwallen-islands.890m.com";
//-------------------------------------------------------------------
$subject = "Your Username at $site_name";
$message = "Hi $user_name,
Thank you for registering at $site_name.
You are two steps away from logging in and accessing our gaming area.
To activate your char, please click here:
http://www.kwallen-islands.890m.com/index.php?pages=activate&id=$userid&code=$password
Once you activate your memebership, you will be able to login with the following information:
Username: $user_name
Password: $password
Thanks
The Webmaster
--------------------------------------------------
This is an automated response, please do not reply
--------------------------------------------------";
mail($email_address, $subject, $message, "From: $replyto \nX-Mailer: PHP/" . phpversion());
echo "<center><font class=\"txt\">Your membership information has been mailed to <b>$email_address</b>, Please check it and follow the directions</font></center>";
$adminsubject = "New Membership at $site_name";
$adminmessage = "Hi Admin,
$user_name has registered @ $site_name, Please login and set user rights.
http://www.kwallen-islands.890m.com/index.php?pages=login_form
Thanks
The Webmaster
--------------------------------------------------
This is an automated response, please do not reply
--------------------------------------------------";
mail($adminemail, $adminsubject, $adminmessage, "From: $first_name $last_name <$email_address> \nX-Mailer: PHP/" . phpversion());
}
?>