Nope still didn't work...
And I actually changed the code around to try and make it easier. Can anyone tell me why after I fill in my form I get a blank page and not the success page??? It's not posting to my site, someone?????
PHP Code:
<?php
//This code runs if the form has been submitted
if (isset($_POST['submit'])) {
//This makes sure they did not leave any fields blank
if (!$_POST['first_name'] ||
!$_POST['last_name'] ||
!$_POST['email'] ||
!$_POST['city'] ||
!$_POST['state'] ||
!$_POST['zip'] ||
!$_POST['gender'] ||
!$_POST['username'] ||
!$_POST['pass'] ||
!$_POST['pass2']) {
die('Whoops!!! Did you forget to fill in one of the fields? Please go back and try again.');
}
// checks if the username is in use
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check) or die(mysql_error());
//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username <strong><u>'.$_POST['username'].'</u></stong> has already been taken. Please choose another username.');
}
// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Whoops!!! I think you made a mistake. We need your passwords to match. Please go back and try again.');
}
// check e-mail format
if (!preg_match("/.*@.*..*/", $_POST['email']) ||
preg_match("/(<|>)/", $_POST['email'])) {
die('Invalid e-mail address.');
}
// no HTML tags in username, website, address, password
$_POST['username'] = strip_tags($_POST['username']);
$_POST['pass'] = strip_tags($_POST['pass']);
$_POST['website'] = strip_tags($_POST['website']);
$_POST['address'] = strip_tags($_POST['address']);
if ($_POST['show_email'] != 0 & $_POST['show_email'] != 1) {
die('Nope');
}
if ($_POST['website'] != '' & !preg_match("/^(http|ftp):///", $_POST['website'])) {
$_POST['website'] = 'http://'.$_POST['website'];
}
// here we encrypt the password and add slashes if needed
// now we insert it into the database
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['email'] = addslashes($_POST['email']);
$_POST['website'] = addslashes($_POST['website']);
$_POST['location'] = addslashes($_POST['location']);
}
$regdate = date('m d, Y');
$insert = "INSERT INTO users (
first_name,
last_name,
email,
address,
city,
state,
zip,
country,
regdate,
gender,
website,
show_email,
username,
password,
last_login)
VALUES (
'".$_POST['first_name']."',
'".$_POST['last_name']."',
'".$_POST['email']."',
'".$_POST['address']."',
'".$_POST['city']."',
'".$_POST['state']."',
'".$_POST['zip']."',
'".$_POST['country']."',
'$regdate',
'".$_POST['gender']."',
'".$_POST['website']."',
'".$_POST['show_email']."',
'".$_POST['username']."',
'".$_POST['pass']."',
'Never')";
$add_member = mysql_query($insert);
?>
<?php
*****************THIS IS WHAT SHOULD COME UP AFTER THE USER CREATES THEIR USERNAME************
SUCCESS Congratulations {USERNAME} your sign up was a success, you may now return to the home page and [login]
HTML Code:
<style type="text/css">
<!--
.style3 {font-weight: bold}
.style4 {font-weight: bold}
-->
</style>
<center><h1>SUCCESS</h1></center><br><br><br><br>
<center>Congratulations <u><strong><?php
print $_POST['username'];
?></u></strong> your sign up was a success, you may now return to the home page and <a href="index.php">[login]</a></center>
HTML Code:
<form id="FormName" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="FormName">
<table width="448" border="0" cellspacing="2" cellpadding="0">
<tr><td width = "150"><div align="right" class="style3">
<p>
<label for="user_firstname">*First Name:</label>
</p>
</div></td>
<td><input id="user_FirstName" name="user_FirstName" type="text" size="25" value="" maxlength="50"></td></tr><tr><td width = "150"><div align="right" class="style4">
<p>
<label for="user_lastname">*Last Name:</label>
</p>
</div></td>
<td><input id="user_LastName" name="user_LastName" type="text" size="25" value="" maxlength="50"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_email">*Email Address: </label>
</strong></div></td>
<td><input id="user_email" name="user_email" type="text" size="25" value="" maxlength="50"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_address">Address</label>
</strong></div></td>
<td><input id="user_address" name="user_address" type="text" size="25" value="" maxlength="40"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_city">*City:</label>
</strong></div></td>
<td><input id="user_city" name="user_city" type="text" size="25" value="" maxlength="25"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_state">*State:</label>
</strong></div></td>
<td><input id="user_state" name="user_state" type="text" size="25" value="" maxlength="20"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_zip">Postal Code: </label>
</strong></div></td>
<td><input id="user_zip" name="user_zip" type="text" size="25" value="" maxlength="10"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_country">*Country:</label>
</strong></div></td>
<td><input id="user_country" name="user_country" type="text" size="25" value="" maxlength="25"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_gender">*Gender:</label>
</strong></div></td>
<td> <select name="user_gender" id="user_gender">
<option selected>Please Choose</option>
<option value="M">Male</option>
<option value="F">Female</option>
</select></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_website">*Website Address: </label>
</strong></div></td>
<td><input id="user_website" name="user_website" type="text" size="25" value="http://" maxlength="100"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="username">*Username:</label>
</strong></div></td>
<td><input id="username" name="username" type="text" size="25" value="" maxlength="20"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_password">*New Password:</label>
</strong></div></td>
<td><input id="user_password" name="user_password" type="password" size="25" value="" maxlength="25"></td></tr><tr><td width = "150"><div align="right"><strong>
<label for="user_id">*Confirm Password: </label>
</strong></div></td>
<td><input id="pass2" name="pass2" type="password" size="25" value="" maxlength="20"></td></tr><tr><td width="150"></td><td>
<input name="submit" type="submit" id="submit" value="Sign Up"></td>
</tr></table>
</form>
Bookmarks