|
Posted by Jimmy Clay on 11/29/44 11:28
Thanks for eveyone's help. It seems to be working now. Here's the program I
came up with:
start of program
<?php
//* badwords.php */
//* Establishes the function check */
function check($message)
{
global $message; //* Gets All Variables */
//To Add New Words, Just Copy One Line From Below And Paste It Below The
Third Line.
//Just Replace the first word in quotes with the word you would like,
//and the second word in quotes to what you would like to change it to.//
$message = str_ireplace("badwordq","**",$message); //* Replaces the word
"hey" into "****" */
$message = str_ireplace("badword2","**",$message);
$message = str_ireplace("badword3","**",$message);
}
?>
end of program
The header problem seems to have been caused by a single space after the
"?>" at the very end.
Also I replace str_replace() with str_ireplace because str_ireplace is not
case sensitive.
In the main program I inserted the lines:
include('badwords.php');
check($message);
--
Jimmy Clay
Read free ebooks !!!!!
Go to my web page:
www.songofthecoyote.com/
"Jimmy Clay" <jimclay@netzero.net> wrote in message
news:1128508887.e5f1c5bf8db916918a5a06c28f641829@teranews...
>I have a very basic question about how to include files to be used by
>another file. I'm trying to include a bad word filter into the guestmap on
>my website. I know almost nothing about PHP code. I've tried everything I
>can think of but I keep getting error messages. The bad word filter code I
>found else where is this:
>
>
> File name is badwords.php
>
> <?php
> //* Check.php */
>
> function check( ) /* Establishes the function check */
> {
>
> global $message; /* Gets All Variables */
>
> //To Add New Words, Just Copy One Line From Below And Paste It Below The
> Third Line.
> //Just Replace the first word in quotes with the word you would like,
> //and the second word in quotes to what you would like to change it to.//
>
> $message = str_replace("bad word1","**",$message); /* Replaces the word
> "hey" into "****" */
> $message = str_replace("bad word2","**",$message);
> $message = str_replace("bad word 3","**",$message);
>
> echo $message;
>
> }
>
> return check(); //* Returns the function check() */
>
> ?>
>
> I would like to keep this as a separate file and include it into the main
> file. In the main file I inserted the two code lines:
>
> include('badwords.php')
> check('$message')
>
> I've tried a lot of different things to get this to work but I always get
> error messages when I run it on my website. I would like to keep it in a
> separate file from the main file because of all the bad words. Also I need
> a function because I would like to have it check the variables for several
> fields.
>
> So what should I do to get this to work?
>
> --
>
> Jimmy Clay
>
> Read free ebooks !!!!!
> Go to my web page:
> www.songofthecoyote.com/
>
>
Navigation:
[Reply to this message]
|