Help with registration form?
Hi, I really need help making a registration form.
This is the coding I'm using in my php file:
<?php
mysql_connect("localhost", "a7427972", "*********") or die (mysql_error());
mysql_select_db("a7427972_tulip") or die (mysql_error());
?>
<?php
$insert_query = 'insert into users (
email,
username,
password
)
values
(
"' . $_POST['email'] . '",
"' . $_POST['username'] . '",
"' . md5($_POST['password']) . '"
)';
mysql_query($insert_query);
?>
And I have a database with this info:
id_user int(11) NOT NULL No auto_increment
username varchar(16) NOT NULL latin1_general_ci
email varchar(64) NOT NULL latin1_general_ci
password varchar(32) NOT NULL latin1_general_ci
And my html is this:
<b><p>Register:</p></b>
<form name="registration_form" method="post" action="register.php"
onsubmit="return Validate();">
<p>Username:</p><input type="text" name="user">
<p>Email:</p><input type="text" name="email">
<p>Password:</p><input type="password" name="pwd">
<p>Confirm Password:</p><input type="password" name="conpwd">
<input type="submit" value="Register">
</form>
<script language = "Javascript">
function Validate()
{
if (document.registration_form.user.value == '')
{
alert('Please fill in your desired username!');
return false;
}
if (document.registration_form.email.value == '')
{
alert('Please fill in your email address!');
return false;
}
if (document.registration_form.pwd.value == '')
{
{
alert('Please fill in your desired password!');
return false;
}
if (document.registration_form.conpwd.value == '')
{
alert('Please fill in your password again for confirmation!');
return false;
}
if (document.registration_form.pwd.value !=
document.registration_form.conpwd.value)
{
alert("The two passwords are not identical! "+
"Please enter the same password again for confirmation");
return false;
}
return true;
}
</script>
But whenever I try to make a test account, this is what comes up:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a7427972'@'localhost' (using password: YES) in /home/a7427972/public_html/register.php on line 3
Access denied for user 'a7427972'@'localhost' (using password: YES)
Please help, I don't know why it's doing this, it's so frustrating.
|