= $rangestart) && ($remote_ip <= $rangeend)) { return true; } else { return false; } } // ******************************************************************************* // IMAP Get Full Header // (Thanks JamieD - http://www.codingforums.com/archive/index.php?t-89994.html) // Returns an array containing the original message header // ******************************************************************************* function imap_get_full_header( $p_stream, $p_msg_number ) { $header_string = imap_fetchheader ( $p_stream, $p_msg_number ); $header_array = explode ( "\n", $header_string ); foreach($header_array as $line) { if(eregi("^([^:]*): (.*)", $line, $arg)) { $header_obj[$arg[1]] = $arg[2]; $last = $arg[1]; } else { $header_obj[$last] .= "\n" . $line; } } return ( $header_obj ); } // ******************************************************************************* // Blocked IP // Performs a DNS check against a specific IP address. // Domain Name Server Blacklists (DNSBLs) use this method to declare whether an // email has been sent from an IP address that has been known to send spam. // ******************************************************************************* function BlockedIP($Suspect_IP, $DNSvr_Address) { $ReverseOrderedIP = array_reverse(explode('.', $Suspect_IP)); $FullLookupAddress = implode('.', $ReverseOrderedIP) . '.' . $DNSvr_Address; if ($FullLookupAddress != gethostbyname($FullLookupAddress)) { return true; } else { return false; } } // ******************************************************************************* // Sender IP // Given a mailbox and message number, this routine returns the IP address of // computer that sent the email. The "from" address can be faked, this IP // address cannot. // ******************************************************************************* function senderip($mbox, $num){ $struct = imap_get_full_header($mbox, $num); $str_in = $struct['Received-SPF']; $tween=""; // not needed but good practise when appending $chr1='client-ip='; $chr2=';'; for ($i=strpos($str_in, $chr1)+10;$i