Basic question about incuding files and funcitons
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Basic question about incuding files and funcitons

From: Jimmy Clay <jimclay@netzero.net>
Date: Wed Oct 05 2005 - 12:41:20 CEST

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/
Received on Tue Oct 18 02:32:10 2005