monkeytooth Posted August 12, 2009 Share Posted August 12, 2009 Ok maybe I am putting to much thought into this, and made it much more complex and complicated then it needs to be.. in thought atleast. So I want to make a filter for my text fields mainly my textarea's but I would like to use an array as my list of stuff to not allow. Using the inputs as the string.. The unfortunate side to this all is I have worked it up so much in my head I can no longer wrap the idea appropriately.. Can anyone throw me a bone and help me out? Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/ Share on other sites More sharing options...
smerny Posted August 12, 2009 Share Posted August 12, 2009 function myfilter ($str) { $filter_search = array( //Array of regex statements finding what you want to replace ); $filter_replace = array( //Array of what you want them to be replaced with ); $str = preg_replace ($filter_search, $filter_replace, $str); return $str; } Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/#findComment-896088 Share on other sites More sharing options...
smerny Posted August 12, 2009 Share Posted August 12, 2009 actually, might not even need regex statements depending on how you want your filter to work... if you just want to replace certain words for example Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/#findComment-896089 Share on other sites More sharing options...
monkeytooth Posted August 12, 2009 Author Share Posted August 12, 2009 Generally I want to take something like [ url = ](minus the spaces)... or [ link = ] basic bulletin board code.. and filter it out.. I am working on a fuction to ultimately deny those messages.. as one of my sites is become subject to a serious of spam bots in the "Contact" section where the form is for contact. And its a public form for members and non member's alike so its a prime target. Lately I have been hit by either the same bot or multiple bots several times a day.. always from a different IP so I can't block the IP's.. so my thought process is if the message contains certain things.. like the BBCode, or other key definitions I am looking for that seem reoccurring with these bots is to make the form look like its working for them but ultimately not send the message.. Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/#findComment-896182 Share on other sites More sharing options...
HoTDaWg Posted August 12, 2009 Share Posted August 12, 2009 i might have misread your post, but why dont you use a CAPTCHA to get rid of the spam bots? Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/#findComment-896213 Share on other sites More sharing options...
monkeytooth Posted August 12, 2009 Author Share Posted August 12, 2009 cause unfortunately the people who use the site and the people who back the site aren't that savvy.. and anything outside the norm.. is apparently to much for them, and they think the users of the site or less intelligent then them and most rocks.. so they wont go for such things.. up to me to tempt to battle through other means.. Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/#findComment-896394 Share on other sites More sharing options...
MatthewJ Posted August 12, 2009 Share Posted August 12, 2009 Yeah, making someone type words they see on the screen... that's a tough one Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/#findComment-896423 Share on other sites More sharing options...
monkeytooth Posted August 12, 2009 Author Share Posted August 12, 2009 i know this, you know this.. they refuse to believe this.. Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/#findComment-896459 Share on other sites More sharing options...
smerny Posted August 12, 2009 Share Posted August 12, 2009 so you basically want to check for bbc code and if it exists... don't send the message? Link to comment https://forums.phpfreaks.com/topic/169852-arrays-strings/#findComment-896474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.