c# - Which is the best way to Prevent Bad word entry in Discussion module in my site -


in web site hackers entering bad words. best way prevent this?

i using asp.net, c# , sql server resources.

  1. check bad words in form backend ?
  2. check bad words in javascript?
  3. check bad words in stored procedure before insert?

i think first method best.

please tell optimized code check

now using method

    var filterwords = ["fool", "dumb", "couch potato"];     // "i" ignore case , "g" global     var rgx = new regexp(filterwords.join(""), "gi");      function wordfilter(str) {                       return str.replace(rgx, "****");                }      // call function     document.write("original string - ");     document.writeln("you fool. why dumb  <br/>");        document.write("replaced string - ");     document.writeln(wordfilter("you fool. why dumb"));    

reality can’t prevent 100% of bad words. i’d go two-step verification on server side (js can disabled , sql not suitable handling this)

  1. create list of common bad words used – catch 80% of inputs.

  2. create list of patterns suspects signal manually verify these.

    this patterns such as

    • a) word contains 2 or more ** characters
    • b) word contains letters , 1 of following characters 0,3,$, , others

in time you’ll have keep both lists updated. again, not solve 100% of cases catch , fix 95% if implemented properly.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -