function spambot_account_ip_addresses in Spambot 6.3
Same name and namespace in other branches
- 8 spambot.module \spambot_account_ip_addresses()
- 7 spambot.module \spambot_account_ip_addresses()
Retrieves a list of IP addresses for an account
Parameters
$account: Account to retrieve IP addresses for
Return value
An array of IP addresses, or an empty array if none found
2 calls to spambot_account_ip_addresses()
- spambot_account_is_spammer in ./
spambot.module - Checks an account to see if it's a spammer. This one uses configurable automated criteria checking of email and username only
- spambot_user_spam_admin_form_submit in ./
spambot.pages.inc
File
- ./
spambot.module, line 350
Code
function spambot_account_ip_addresses($account) {
$hostnames = array();
// Retrieve IPs from node_spambot table
$result = db_query("SELECT DISTINCT hostname FROM {node_spambot} WHERE uid = %d", $account->uid);
while ($object = db_fetch_object($result)) {
$hostnames[] = $object->hostname;
}
// Retrieve IPs from any sessions which may still exist
$result = db_query("SELECT DISTINCT hostname FROM {sessions} WHERE uid = %d", $account->uid);
while ($object = db_fetch_object($result)) {
$hostnames[] = $object->hostname;
}
// Retrieve IPs from comments
if (module_exists('comment')) {
$result = db_query("SELECT DISTINCT hostname FROM {comments} WHERE uid = %d", $account->uid);
while ($object = db_fetch_object($result)) {
$hostnames[] = $object->hostname;
}
}
// Retrieve IPs from statistics
if (module_exists('statistics')) {
$result = db_query("SELECT DISTINCT hostname FROM {accesslog} WHERE uid = %d", $account->uid);
while ($object = db_fetch_object($result)) {
$hostnames[] = $object->hostname;
}
}
// Retrieve IPs from user stats
if (module_exists('user_stats')) {
$result = db_query("SELECT DISTINCT ip_address FROM {user_stats_ips} WHERE uid = %d", $account->uid);
while ($object = db_fetch_object($result)) {
$hostnames[] = $object->ip_address;
}
}
$hostnames = array_unique($hostnames);
return $hostnames;
}