Jump to content

Mixed Characters - Help?


PierceCoding

Recommended Posts

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

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

 

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  :facewall:

stristr() works for what I want it to do.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.