function spambot_username_validate in Spambot 6
Validation function
Parameters
mixed $element Posted form structure:
1 string reference to 'spambot_username_validate'
- spambot_form_alter in ./
spambot.module - Implementation of hook_form_alter().
File
- ./
spambot.module, line 18
Code
function spambot_username_validate($element) {
// exipioauro@gmail.com
$mail = urlencode($element['#post']['mail']);
$name = urlencode($element['#post']['name']);
if ($mail && _spambot_request('http://www.stopforumspam.com/api?email=' . $mail)) {
$block = true;
watchdog("spambot", t("blocked spambot: @mail", array(
"@mail" => $mail,
)));
}
else {
if ($name && _spambot_request('http://www.stopforumspam.com/api?username=' . $name)) {
$block = true;
watchdog("spambot", t("blocked spambot: @name", array(
"@name" => $name,
)));
}
}
if ($block) {
form_set_error('name', t("Blacklisted. Now go away!"));
form_set_error('mail', t("Blacklisted. Now go away!"));
}
}