- $IPs = array();
- $i = 0;
- while ($i < count($read)) {
- // EIMS will give funky results
- $Chunks = explode(' ', $read[$i]);
- if ($Chunks[0] != '*') {
- $i ++;
- continue;
- }
- $MsgNum = $Chunks[1];
-
- $i ++;
-
- // Look through all of the Received headers for IP addresses
- // Stop when I get ")" on a line
- // Stop if I get "*" on a line (don't advance)
- // and above all, stop if $i is bigger than the total # of lines
- while (($i < count($read)) &&
- ($read[$i][0] != ')' && $read[$i][0] != '*' &&
- $read[$i][0] != "\n")) {
- // Check to see if this line is the right "Received from" line
- // to check
- if (is_int(strpos($read[$i], $SpamFilters_YourHop))) {
- $read[$i] = ereg_replace('[^0-9\.]', ' ', $read[$i]);
- $elements = explode(' ', $read[$i]);
- foreach ($elements as $value) {
- if ($value != '' &&
- ereg('[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}',
- $value, $regs)) {
- $Chunks = explode('.', $value);
- $IP = $Chunks[3] . '.' . $Chunks[2] . '.' .
- $Chunks[1] . '.' . $Chunks[0];
- foreach ($filters as $key => $value) {
- if ($filters[$key]['enabled'] &&
- $filters[$key]['dns']) {
- if (strlen($SpamFilters_DNScache[$IP.'.'.$filters[$key]['dns']]) == 0) {
- $IPs[$IP] = true;
- break;
- }
- }
- }
- // If we've checked one IP and YourHop is
- // just a space
- if ($SpamFilters_YourHop == ' ') {
- break; // don't check any more
- }
- }
- }
- }
- $i ++;
- }
- }
-