Someone knows how to count how many time string A is in string B?
Example:
I made a anti-swear-plugin and added words like "low" or "affe (german for ape)", but now it blocks words like "glow" and "waffe (german for weapon)" too, so i added an ignore list looks like:
PHP Code:
new i = 0
while ( i < g_swearNum_high )
{
if ( containi ( message, badword_high[i++] ) != -1 )
{
b_found++
}
}
i = 0
while ( i < g_swearNum_ignore )
{
if ( containi ( message, badword_ignore[i++] ) != -1 )
{
b_ignore++
}
}
if(b_found != b_ignore)
{
... // there is a badword found
}
But if you say the same badword more times, you can still insult like "glow you low", because it sets the variable b_found only +1 (it checks if the word "low" is inside the string and not how many times it's inside).
Someone understand that and knows how to fix it? xD