|
uCoz Community uCoz Modules Forum Illegal words on Forum |
Illegal words on Forum |
Hi there,
In my site many users post Illegal words on their massage and I have all ready blocked those words on URL Blocking. But Is this is possible that, "If someone type any Illegal word then a Ajax window will pop up on right corner in below and Saying that, 'Illegal words not allowed' " If there is any problem to understand what I'm trying to say then please reply Best Regards ------------------- Susmoy If I Help you then Please +Rep and Awards
|
ok i will give you a script
<form name = "myform"> <textarea id = "txt1" rows = "10" cols = "60"></textarea> <br><br> <input type = "button" id = "but1" value = "Check the text for smut" onclick="noHTML();smutfilter()"> </form> <script type = "text/javascript"> function noHTML() { txt=document.myform.txt1.value; txt = txt.replace(/\<|\>/g," "); txt = txt.replace(/\sscript\s/gi,""); txt = txt.replace(/\sdiv\s/gi,""); // similarly delete any other unwanted tags document.myform.txt1.value = txt; } function smutfilter() { var smut="*#*?*&*%*!*#*?*&*%*!*#*?*&*%*!"; var badnum=0; // Make your list of bad words here. Note each bad word is separated by a space with a final space at the end. Note also that upper case initial characters can be overcome by testing only for the remaining ones e.g. obacco, ottery etc. cmp="Nazi nazi REE obacco igarette pics pix ortgage debt loan lucky wager gaming asino drug lcohol addict "; txt=document.myform.txt1.value; for (var i=0;i<17;i++) { // 17 is number of bad words in the list - must be correct or browser may crash!pos=cmp.indexOf(" "); wrd=cmp.substring(0,pos); wrdl=wrd.length; cmp=cmp.substring(pos+1,cmp.length); while (txt.indexOf(wrd)>-1) { pos=txt.indexOf(wrd); txt=txt.substring(0,pos)+smut.substring(0,wrdl)+txt.substring((pos+wrdl),txt.length); badnum = badnum+1; // count number of bad words } } document.myform.txt1.value = txt; } </script> don't forget to increase my rep and give an award if i helped internet my mom and html are my weak points : www.isurfer.tk
|
add it to the forum page but Remember that JavaScript form validation only provides convenience for users, not security. This means that JavaScript should be used as an "enhancement", not as a requirement. So your form should not be dependent on JavaScript alone to perform your validation. Instead, whatever server-side language you use to process the form (PERL, ASP, PHP, etc.) should also perform the same validation. Otherwise, people will be able to bypass your validation (and even possibly inject malicious code) simply by disabling JavaScript.
internet my mom and html are my weak points : www.isurfer.tk
|
Susmoy, we do not help with custom coding, although you may get a good answer by requesting a script in the following thread - http://forum.ucoz.com/forum/25-13186-1
|
| |||
| |||