I am trying to create a simple PHP form where the user must enter one of six predetermined passwords, these will be TSS01, TSS02, TSS03, TSS04, TSS05 and TSS06.
The form currently functions properly when using only numeric passwords.
PHP coding follows:
<?php
if(empty($_POST['name']) || empty($_POST['code'])) {
die(print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">");
}
$name=$_POST['name'];
$code=$_POST['code'];
$to='email@email.com';
$headers = 'From: '.$name."
" .
'Reply-To: '.$name."
" .
'X-Mailer: PHP/' . phpversion();
$subject = 'SECRET SUPPER FORM ENTRY';
$body='Entry References'."
";
$body.='Name: '.$name."
";
$body.='Code: '.$code."
";
if( !empty( $_POST['code'] ) && $_POST['code'] == TSS01) {
$submit = mail($to, $subject, $body, $headers, "From: <$name>");
print "<meta http-equiv=\"refresh\" content=\"0;URL=success.html\">";
} else {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
How can this form be verified by any six of these passwords? The passwords are already set and cannot be changed, they must be those exactly.