hello all. im trying to follow a tutorial on how to set up a login system for my website (you can view the tutorial HERE.) when i fill out the form from the registration page i created, it sends me to a "http 404 not found error" page and it seems its trying to open a page named "1" which isnt on my website. also, none of the information is being sent to my database( database = db, table = members). i thought i was following the tutorial properly but i guess im missing something. here is the code i have for the registration page so far...
<?php
// Connects to your Database
mysql_connect("localhost","root") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
//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['full_name'] | !$_POST['rap_name'] | !$_POST['email'] | !$_POST['email2'] | !$_POST['password'] | !$_POST['password2'] | !$_POST['state'] | !$_POST['sex'] ) {
die('You did not complete all of the required fields') or die(mysql_error());
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['email'] = addslashes($_POST['email']) or die(mysql_error());
}
$emailcheck = $_POST['email'] or die(mysql_error());
$check = mysql_query("SELECT email FROM members WHERE email = '$emailcheck'")
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 email '.$_POST['email'].' is already in use.') or die(mysql_error());
}
// this makes sure both emails entered match
if ($_POST['email'] != $_POST['email2']) {
die('Your emails did not match. ');
}
// this makes sure both passwords entered match
if ($_POST['password'] != $_POST['password2']) {
die('Your passwords did not match. ');
}
// here we encrypt the password and add slashes if needed
$_POST['password'] = md5($_POST['password']) or die(mysql_error());
if (!get_magic_quotes_gpc()) {
$_POST['password'] = addslashes($_POST['password']) or die(mysql_error());
$_POST['email'] = addslashes($_POST['email']) or die(mysql_error());
}
// now we insert it into the database
$insert = "INSERT INTO members (full_name, rap_name, email, password, state, sex) VALUES ('".$_POST['full_name']."', '".$_POST['rap_name']."', '".$_POST['email']."', '".$_POST['password']."', '".$_POST['state']."', '".$_POST['sex']."')" or die(mysql_error());
$add_member = mysql_query($insert) or die(mysql_error());
?>
<body>
<h1>Registered</h1>
<p>Thank you, you have registered - you may now login</a></p>
<?php
}
else
{
?>
<form action="<?php echo $_SERVER['PHP_SELF'] or die(mysql_error()); ?>" method="post">
(i excluded this form data. let me know if you need this as well.)
</form>
<?php
}
?>
</body>