Ban Words From Entering into Database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tomclancy
Forum Newbie
Posts: 1
Joined: Wed Apr 15, 2009 6:18 am

Ban Words From Entering into Database

Post by tomclancy »

Hey guys
The scenario is that in my website "Searchfiles.Us" there are many PORN searches being made.and these searchs get recorded into the history table and gets shown up on the frontpage.Which is very unethical.So i want a solution that if i kept a file with all the banned words list on the root directory and a code...so that they dont get entered into the database.Please help me with that coding.

Thank You
www.searchfiles.us
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Ban Words From Entering into Database

Post by pickle »

I don't think I'd call it unethical - plastering user's personal information along with the porn searches would be.

Anyway, build an array of your ban words, iterate through it & use strpos() to check if the banned word is found. If it is, don't do anything else.

I have a feeling there's a better way to do this, but I can't think of it right now.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply