I have an email form on my site which has an action to a php page. The php page detects whether the user has entered a name and email, if they haven't it directs them back, if they have it sends an email to me. I want to add a php cussword filter that would prevent the message from being sent if the message contains any words that i want to block out. Does anyone know how i can accomplish this?
Bubbleboy
0
Light Poster
Recommended Answers
Jump to PostThis is a bit rough, there's probably a better way. But this works.
// Array of blocked words $bad_words[0] = "badword1"; $bad_words[1] = "badword2"; $bad_words[2] = "badword3"; foreach($bad_words as $word) { if(strpos(strtolower($email_message), $word) !== false) { // Set flag to check when you exit the loop $message_ok …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.