PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
//part that check if password is 0 and if password is same as the second password
if(strlen($_POST['password'])>0)
{
$password = '1';
}
else
{
$password_empty ='<font style="color: '.$tcolour.'; font-size:'.$tfontsize.'px;">* Enter a password</font>';
}
// line 50
if ($_POST['password'] == $_POST['password_confirm'])
{
$password_confirm = '1';
}
else
{
$password_confirm_emtpy ='<font style="color: '.$tcolour.'; font-size:'.$tfontsize.'px;">* you''re password must match</font>';
}
however since the logic is kinda.. as you said i would still like to know how you would handle this. Unless that comment has something do to do with the returning the value
$error = '';
// you may want a regex to confirm syntax and correct length of the password...
if(!empty($_POST['password']) && !empty($_POST['password_confirm']) && $_POST['password'] === $_POST['password_confirm'])
{
// yay, they match! do your insert and redirect or whatever...
}
else
{
if(empty($_POST['password']))
{
$error .= (!empty($error)?'<br />':'').'• must enter a password';
}
if(empty($_POST['password_confirm']))
{
$error .= (!empty($error)?'<br />':'').'• must confirm password';
}
if(!empty($_POST['password']) && !empty($_POST['password_confirm']) && $_POST['password'] !== $_POST['password_confirm'])
{
$error .= (!empty($error)?'<br />':'').'• passwords did not match';
}
die((!empty($error)?$error:'uncaught error, oops.'));
}