Hello all,
I seem to be missing something with my login script,
I have a couple of issues:

1) When you do not enter any informaton, it will say:
"Please fill out all fields to proceed.
There seems to be a problem with the database."

Now, if i hit enter again it will say:
"Please fill out all fields to proceed.
Sorry, username is already taken, please choose another.
There seems to be a problem with the database."

and if you enter information into all hte fields it will give you what it is
suppose to:
"Thank you for registering, You may go here to login "link here""

What am I missing? if you find any other bugs, please let me know
Thanks for any help.
Kevin

Here is my code:
------------------------------------------------
<html><head>
<title>Register</title></head>
<body>
<form method=post action="<? echo $PHP_SELF; ?>">
<table cellpadding=2 cellspacing=0 border=0>
<td>Username:</td><td><input type="text" name="username" size=10></td><tr>
<td>Password:</td><td><input type="password" name="password"
size=10></td><tr>
<td>Email:</td><td><input type="text" name="email" size=15></td><tr>
<td> </td><td><input type="submit" name="submit" value="register"></td>
</table></form>
</body>
</html>
<?php
include'dbcon.inc';
if(isset($submit)) {
dbConnect('login');

// Make sure all fields are filled out
if ($username=="" or $password=="" or $email=="") {
echo("Please fill out all fields to proceed.<br>");
}

// Make sure there is not the same name in the database
$query = "SELECT COUNT(*) FROM user WHERE name = '$username'";
$result = mysql_query($query);
if (!$result) {
echo("There seems to be a problem with the database.<br>");
}
if (mysql_result($result,0,0)>0) {
echo("Sorry, username is already taken, please choose another.<br>");
}

//Insert info into databse
$query2="INSERT INTO user (name, password, email) VALUES ('$username',
'$password', '$email')";
$result2 = mysql_query($query2);
if (!$result2) {
echo("There seems to be a problem with the database.<br>");
} else {
 echo'Thank you for registering, You may go here to login "link here"';
 }
}
?>

Reply via email to