Okay this code is funky and I have no idea why. It is supposed to check the format of things in a field and to make sure the password verify field matches the password field. It is supposed to do the same for the email. Unless both the e-mail and password verifies are messed up, it will think things are okay. So if both passwords match and e-mails dont it will think e-mails match. But if neither passwords or e-mails match it will know.
elseif ($key == "username")
{
if (!ereg("^[A-Za-z0-9]{1,30}$",$HTTP_POST_VARS[$key]) )
{
$bad_format[$key] = "bad";
$badusername = "must be 1-30 characters long made of letters and numbers";
}
}
elseif ($key == "password")
{
if (!ereg("^[A-Za-z0-9]{5,10}$",$HTTP_POST_VARS[$key]))
{
$bad_format[$key] = "bad";
$badpassword = "must be 5-10 characters long made of letters or numbers";
}
}
elseif ($key == "repassword")
{
if ("$repassword" != "$password")
{
$bad_format[$key] = "bad";
$badrepassword = "Passwords must match";
}
}
elseif ($key == "email")
{
if (!ereg("^[A-Za-z0-9 -]+@.+\\.(org|(com|net))+$",$HTTP_POST_VARS[$key]) )
{
$bad_format[$key] = "bad";
$bademail = "must be valid [email]email@server.com[/email] .net or .org no more than 50 characters long";
}
}
elseif ($key == "veemail")
{
if ("$veemail" != "$email")
{
$bad_format[$key] = "bad";
$badveemail = "must match E-mail";
}
}
The username field works fine no matter what. Any help is much appreciated.