Spectre Posted January 11, 2008 Share Posted January 11, 2008 Hey all, using an ajax chat and have the filter set up by db table to replace $before with $after... Pretty simple, just not so sure how to make it take the before as non case sensitive so i don't have to put every combination of a word in the before column, any tips? ideas? ways to do this easily? Quote Link to comment https://forums.phpfreaks.com/topic/85573-solved-sql-swear-filter/ Share on other sites More sharing options...
GingerRobot Posted January 11, 2008 Share Posted January 11, 2008 That depends on how you're doing your replacement. If you're using ereg_replace(), use eregi_replace(), if you're using preg_replace(), use the case insensitive modifier. If you're using str_replace(), use str_ireplace() Of course, you'll still have users putting spaces/other symbols in between letters to get around your filter anyway. Quote Link to comment https://forums.phpfreaks.com/topic/85573-solved-sql-swear-filter/#findComment-436778 Share on other sites More sharing options...
nikefido Posted January 11, 2008 Share Posted January 11, 2008 you can use an array in something like str_replace, right? So you can have an array or words you want to filter and just one statement? Quote Link to comment https://forums.phpfreaks.com/topic/85573-solved-sql-swear-filter/#findComment-436781 Share on other sites More sharing options...
GingerRobot Posted January 11, 2008 Share Posted January 11, 2008 you can use an array in something like str_replace, right? So you can have an array or words you want to filter and just one statement? Indeed - but take any swear word and think of all the different ways that you could communicate that swear word without spelling it out exactly (e.g. symbols to represent letters, spaces in between, other symbols inbetween, mis-spelling etc). Now do the same for every other swear word you can think of. That's going to be one very large array. Quote Link to comment https://forums.phpfreaks.com/topic/85573-solved-sql-swear-filter/#findComment-436786 Share on other sites More sharing options...
kratsg Posted January 11, 2008 Share Posted January 11, 2008 you can use an array in something like str_replace, right? So you can have an array or words you want to filter and just one statement? Indeed - but take any swear word and think of all the different ways that you could communicate that swear word without spelling it out exactly (e.g. symbols to represent letters, spaces in between, other symbols inbetween, mis-spelling etc). Now do the same for every other swear word you can think of. That's going to be one very large array. It is indeed a large array, use what GingerRobots previously said (ignoring str_replace): That depends on how you're doing your replacement. If you're using ereg_replace(), use eregi_replace(), if you're using preg_replace(), use the case insensitive modifier. If you're using str_replace(), use str_ireplace() Of course, you'll still have users putting spaces/other symbols in between letters to get around your filter anyway. The idea being ereg, preg, etc... is that it uses PATTERNS to match swear words. While I can almost guarantee that there is no perfect system for all swear words, you can get pretty darn close. Quote Link to comment https://forums.phpfreaks.com/topic/85573-solved-sql-swear-filter/#findComment-436802 Share on other sites More sharing options...
Spectre Posted January 11, 2008 Author Share Posted January 11, 2008 Thanks guys I just for now need it to check irresepctive of which letters they capitalise, anything else they do, spaces, symbols etc will be bannable from chat offences Quote Link to comment https://forums.phpfreaks.com/topic/85573-solved-sql-swear-filter/#findComment-436808 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.