我很难验证两个密码是否匹配,用户名是否唯一。
除非所有字段都已完成,否则代码目前不允许用户创建配置文件。
我想确保用户无法创建配置文件,除非密码匹配且具有唯一的用户名。
非常感谢,
if($submitaccount)
{
if ($password != $confirmpassword)
{
if($FirstName&&$LastName&&$DOB&&$userName&&$email&&$password&&$$confirmpassword)
{
$sql=mysql_query("SELECT FROM users (username, password, email) WHERE username=$fusername");
if(mysql_num_rows($sql)>=1)
{
echo"name already exists";
}
else
$insert=mysql_query("INSERT INTO WebsiteUsers (FirstName,LastName, userName, email, pass, DOB)
VALUES ('$FirstName','$LastName','$userName','$email','$password','$DOB') ");
echo "<SCRIPT LANGUAGE='JavaScript'>
window.alert('Account Has Been Created!.')
window.location.href='index.html'
</SCRIPT>";
}
else
{
echo "<SCRIPT LANGUAGE='JavaScript'>
window.alert('Please Complete All Fields.')
window.location.href='account.html'
</SCRIPT>";
}
else
{
echo "<SCRIPT LANGUAGE='JavaScript'>
window.alert('Passwords do not match!.')
window.location.href='account.html'
</SCRIPT>";
}
}
}
}