Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 04:19
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Recent Tutorial Support
| |-+  Flash GuestBook Support (Moderators: Flash-db, vesa kortelainen, Ronald Wernecke, Mohsin Sumar, Jorge Solis)
| | |-+  block RUDE words %#@&
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: block RUDE words %#@&  (Read 2105 times)
bob
Server what's that
*
Posts: 7



View Profile Email
« on: 02/12/02, 23:15 »

HI
is it possible to block out any rude words entered into the guestbook when the submit button is pressed???
im not a coder but im learning and i love these tutorials
Please help

ive found this script in html on The JavaScript Source!!
it seems to work
does any one know how to incorperate it in to the flash guestbook
///////
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Cut-N-Paste JavaScript
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function smutEngine() {
smut="#@&*%!#@&*%!#@&*%!";
cmp="sex babes shit fuck damn porno cum cunt prick pecker ass "
+"asshole pedophile man-boy man/boy dong twat ";
txt=document.isn.dirt.value;
tstx="";
for (var i=0;i<16;i++){
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);
  }
}
document.isn.dirt.value=txt;
}
// End -->
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<CENTER>
<FORM NAME="isn">
<DIV ALIGN=CENTER><INPUT TYPE="text" NAME="dirt" SIZE=40 VALUE=""><BR>
<INPUT TYPE="button" NAME="smut1" VALUE=" Submit " onClick="smutEngine(this.form)">
</DIV>
</FORM>
</CENTER>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size:  1.31 KB  -->
</body>
</html>
/////////////
SOLID   Huh Shocked
Logged
sam
Server what's that
*
Posts: 4



View Profile Email
« Reply #1 on: 02/14/02, 00:35 »

hello there
can you show me how can i put that script in where
on the guestbook flash .. like in the .swf or Guestbook.php , Guestbook.txt , or the index page ... thank a lot  i  Huh dont know how to do it ...
Logged
Flash-db
Administrator
Systems Administrator
*****
Posts: 1867



View Profile WWW
« Reply #2 on: 02/17/02, 14:37 »

Here's how to filter out bad words:

This is probably the least elegant way but will work, you can use the PHP string replace function.  Place this on the first couple lines of the script:

$Comments = str_replace("Shit", "", $Comments);

This is the basic idea - it will replace Shit with nothing if you want to do a search and replace you can use something like this:

$Comments = str_replace("Shit", "****", $Comments);

With the above any occurance of the characters Shit will be replaced by ****

You can just add the ones you want to replace line by line, for example:
$Comments = str_replace("Crap", "****", $Comments);

Note that str_replace(); replace is case sensitive - which will cause problems.


An incase sensitive alternative would be to use the eregi function:

$Comments = eregi_replace("Shit", "****", $Comments);

This function is slower then the str_replace function but you probably will not notice it.

For more information:

http://www.php.net/manual/en/function.eregi-replace.php
and
http://www.php.net/manual/en/function.str-replace.php
Logged

-Jeff.
bob
Server what's that
*
Posts: 7



View Profile Email
« Reply #3 on: 02/17/02, 21:46 »

 Grin Grin
thanks jeff your DA MAN!!!!!!!
Grin Grin

SOLID Cheesy
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything