PierceCoding Posted August 6, 2009 Share Posted August 6, 2009 Hi there, I've been searching for hours on how to properly do this. No luck so far! Anyways, I do not want to limit things to being only caps or only lowercase. I also do not want to write out every single possible word for filtering. Example: $word = "Swear Word"; if(strstr($paragraph,$word)) { die($die_error); } I don't want to have to type this out 50 different ways like: SWEAR WORD SwEaR WoRd SWeaR WORd etc.. I am unable to find a function where it will understand the word whether it is mixed, fully caps, or lowercase. I'm sure they have this for badword filters as people could just bypass the badword filter by typing a swear in via mixed case like "SwEaR WoRDs". Any help is appreciated Link to comment https://forums.phpfreaks.com/topic/169068-mixed-characters-help/ Share on other sites More sharing options...
watsmyname Posted August 6, 2009 Share Posted August 6, 2009 Hi there, I've been searching for hours on how to properly do this. No luck so far! Anyways, I do not want to limit things to being only caps or only lowercase. I also do not want to write out every single possible word for filtering. Example: $word = "Swear Word"; if(strstr($paragraph,$word)) { die($die_error); } I don't want to have to type this out 50 different ways like: SWEAR WORD SwEaR WoRd SWeaR WORd etc.. I am unable to find a function where it will understand the word whether it is mixed, fully caps, or lowercase. I'm sure they have this for badword filters as people could just bypass the badword filter by typing a swear in via mixed case like "SwEaR WoRDs". Any help is appreciated well convert the user input to lowercase and check it against your list. forexample you have "swear word" in your list, $userword=strtolower($_GET["user_word"]); and check this $userword against your list hope you understood what i meant Link to comment https://forums.phpfreaks.com/topic/169068-mixed-characters-help/#findComment-892021 Share on other sites More sharing options...
PierceCoding Posted August 6, 2009 Author Share Posted August 6, 2009 well convert the user input to lowercase and check it against your list. forexample you have "swear word" in your list, $userword=strtolower($_GET["user_word"]); and check this $userword against your list hope you understood what i meant Hey thanks for your help, I actually just found it. The function I was using was case-sensitive stristr() works for what I want it to do. Link to comment https://forums.phpfreaks.com/topic/169068-mixed-characters-help/#findComment-892026 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.