$message = "Hey, I'm spam! I like your site";
// Open blacklist file
$blacklist = file("/home/phpit/public_html/demo/blacklist spam php/blacklist.txt");
// Loop through blacklist, and check message
foreach ($blacklist as $item) {
????// Check if item isn't empty or comment
????$item = trim($item);
????if (!empty($item) AND substr($item, 0, 1) != "#") {
????????// Not a comment, or empty, check message
????????if (preg_match("/" . $item . "/i", $message, $match)) {
????????????// Blacklisted URL found
????????????die("Sorry, your message has been denied because a blacklisted URL (" . $match['0'] . ") has been found.");
????????}
????}
}
?>