Currently, I have the following and it works so there is no big rush:
[php] foreach ($data as $key => $value) {
if ($value && $key != ‘subject’) {
$_SESSION[$key] = $value;
} elseif ($key != ‘subject’) {
$errMsg[‘blank’] = “Empty Input, Please Fillout Completely!”;
}
}
if ($data[‘subject’]) {
$spambotError = “Stupid Spambot!!!”;
clearSession();
}
/* Username 5-32 characters long, letter & numbers only, and starts with a letter /
$errMsg[‘username’] = $validate->checkUsername($data[‘username’]);
/ Check username availability in the database table */
$errMsg[‘availability’] = $validate->checkAvailability($data[‘username’]);
$errMsg[‘email’] = $validate->validateEmail($data[‘email’]);
$data[‘password’] = filter_input(INPUT_POST, ‘password’, FILTER_SANITIZE_SPECIAL_CHARS);
$errMsg[‘password’] = $validate->checkPassword($data[‘password’]);
$data[‘confirm_password’] = filter_input(INPUT_POST, ‘confirm_password’, FILTER_SANITIZE_SPECIAL_CHARS);
$errMsg[‘mismatch_password’] = $validate->passwordMatch($data[‘password’], $data[‘confirm_password’]);
if ( empty($errMsg[‘username’])
&& empty($errMsg[‘blank’])
&& empty($errMsg[‘availability’])
&& empty($errMsg[‘email’])
&& empty($errMsg[‘password’])
&& empty($errMsg[‘confirm_password’])
&& empty($errMsg[‘mismatch_password’])
&& !$spambotError) {
$database->create($data);
header(“Location: forums.php”);
exit();
}[/php]
However, there has to be a better way than have that ugly if statement? I just want to check to see if the error array $errMsg is empty and I tried everything, I thought I had a solution with if (empty(filter_array($errMsg)) … but it worked good on the local server, but when I put it on the web server it farted out on me. ;D
Any help would be greatly appreciated.
John