Breana Posted July 5, 2009 Share Posted July 5, 2009 While my site was online, i started to notice members/guest using my search page for certin words i find wrong, and feel should be banned! It was both male and female users witch surprised and shocked me, i did not think of it before i seen them searching these words. For last week i have been re-building it but am stuck on the banned keyword part... i can get it to limit words one, buy one but not in full sentences. example: preteen girls live on cam. It's suppost to say banned word. preteen is a banned word, but only removes it if it is alone, here lies my issue how can i make it remove it if there is other words in the search? I have several banned words but i have to make an if statement for each one i bann. // SET BANNED WORDS if($search_txt == "preteen"){ header("Location: illegal_action.php?action=key_illegal(preteen)"); } if($search_txt == "underage"){ header("Location: illegal_action.php?action=key_illegal(underage)"); } if($search_txt == "nigeria"){ header("Location: illegal_action.php?action=key_illegal(nigeria)"); } if($search_txt == "credit card"){ header("Location: illegal_action.php?action=key_illegal(credit_card)"); } if($search_txt == "trade accounts"){ header("Location: illegal_action.php?action=key_illegal(trade_accounts)"); } if($search_txt == "sell password"){ header("Location: illegal_action.php?action=key_illegal(sell_password)"); } Is there a way to make it read the banned word even if the user adds more to it? Thanks in advanced, Breana Quote Link to comment https://forums.phpfreaks.com/topic/164861-banned-keyword-need-help/ Share on other sites More sharing options...
Zane Posted July 5, 2009 Share Posted July 5, 2009 $search = array('preteen girls', 'nigerian porn', 'sell password', 'credit card', 'trade accounts'); $replace = "banned word"; if(count(preg_filter($pattern, $replace, $search_txt)) != 0) header("Location: illegal_action.php?action=key_illegal($search_txt)"); Code not tested EDIT CODE!! review it Quote Link to comment https://forums.phpfreaks.com/topic/164861-banned-keyword-need-help/#findComment-869364 Share on other sites More sharing options...
Breana Posted July 5, 2009 Author Share Posted July 5, 2009 Thanks for the reply, i tried array once before but i could not get it to load the banned page correctly... Because my banned page is where it records there IP, time, keyword used and member name. Update: i see you have the link different from the way i had it will try it out. Quote Link to comment https://forums.phpfreaks.com/topic/164861-banned-keyword-need-help/#findComment-869367 Share on other sites More sharing options...
waynew Posted July 5, 2009 Share Posted July 5, 2009 Also; searching for the keyword Nigeria should NOT be considered an illegal action - at least not in the sense that you tell the user so. Quote Link to comment https://forums.phpfreaks.com/topic/164861-banned-keyword-need-help/#findComment-869369 Share on other sites More sharing options...
Breana Posted July 5, 2009 Author Share Posted July 5, 2009 Also; searching for the keyword Nigeria should NOT be considered an illegal action - at least not in the sense that you tell the user so. Actually the keyword (Nigeria) was cut off. It's part of a larger system i have for scammer emails listed in search results. The name will black list any member from that email with -10 NEG feedback. And then load the banned page, but it will display a result why. Quote Link to comment https://forums.phpfreaks.com/topic/164861-banned-keyword-need-help/#findComment-869373 Share on other sites More sharing options...
Breana Posted July 5, 2009 Author Share Posted July 5, 2009 It's doing the same this it did to me yesterday, Fatal error: Call to undefined function preg_filter() in C:\wamp\www\site_search.php on line 23 I don't need it to "replace" the word, just load the url to the banned page. I may have altered it wrong O.o lol. // SET BANNED WORDS $search = array('preteen', 'nigerian', 'sell password', 'credit card', 'trade accounts'); if(count(preg_filter($search)) != 0) header("Location: illegal_action.php?action=key_illegal(banned)"); Quote Link to comment https://forums.phpfreaks.com/topic/164861-banned-keyword-need-help/#findComment-869384 Share on other sites More sharing options...
Breana Posted July 5, 2009 Author Share Posted July 5, 2009 I just realized i altered my search box name but still a no go... I will try some more changes, but looks like this option might be KO for now. Quote Link to comment https://forums.phpfreaks.com/topic/164861-banned-keyword-need-help/#findComment-869425 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.