It worked literally 15 minutes before, and I tried to make a small change to the script, erased it because I changed my mind, and now it won't save this information to my database. . . any idea why?
It won't add it to my tables, therefore it won't create user accounts. I have no idea why either. Anyone have any ideas?
PHP:
<?php
//form data
$submit = $_POST['submit'];
$Name = strip_tags($_POST['Name']);
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$email = $_POST['email'];
$repeatemail = $_POST['repeatemail'];
$date = date("Y-m-d");
if ($submit)
{
//opens the database
$connect = mysql_connect('localhost',"******","*******");
mysql_select_db('********'); //Selects the database
$namecheck = mysql_query("SELECT username FROM users WHERE username='$username'");
$count = mysql_num_rows($namecheck);
if ($count!=0)
{
die("Username is already taken, sorry!");
}
$emailcheck = mysql_query("SELECT email FROM users WHERE email='$email'");
$check = mysql_num_rows($emailcheck);
if ($check!=0)
{
die("This email is already taken, sorry!");
}
//Makes sure the fields are filled
if ($Name&&$username&&$password&&$repeatpassword&&$email&&$repeatemail)
{
if ($password==$repeatpassword) //Makes sure the passwords are the same.
{
//Check character length of user name.
if (strlen($username)>25||strlen($Name)>25)
{
echo "Max length of username and your name are 25 characters.";
}
else //Checks the password length
{
if (strlen($password)>25||strlen($password)<6)
{
echo "Password must be between 6 and 25 characters.";
}
else
//Encrypts the passwords.
$password = md5($password);
$repeatpassword = md5($repeatpassword);
//Checks the email lenth
if (strlen($email)>30||strlen($email)<10)
{
echo "Your email must be between 10 and 30 characters.";
}
else //Registers the user.
$queryreg = mysql_query("INSERT INTO users VALUES (' ','$Name','$username','$password','$email','$date'");
echo "You have been registered! <br><a href='**********'> Return to the login page</a>.";
}
}
else
echo "Your passwords do not match!";
}
else
echo "Please fill in all the fields";
}
?>
It won't add it to my tables, therefore it won't create user accounts. I have no idea why either. Anyone have any ideas?