This is for a church website I am working on.
Code: Select all
<?PHP
include("includes/db_connect.php");
include("includes/expletive_filter.php");
if (isset($_POST["pray"]))
{$all_is_good = "yes";
$prayer = $_POST["prayer"];
$prayer_name = $_POST["prayer_name"];
if($prayer=="")
{$message = "<font color=\"#FF0000\">Error: You must enter something in the \"Prayer\" field.</font>";
$all_is_good = "no";}
if($prayer_name=="")
{$message = "<font color=\"#FF0000\">Error: You must enter something in the \"Name\" field.</font>";
$all_is_good = "no";}
if(contains($expletives,$prayer))
{$message = "<font color=\"#FF0000\">Error: You are not allowed to use bad words!</font>";
$all_is_good = "no";}
if($all_is_good=="yes")
{mysql_query("INSERT INTO `prayers` (`prayer`,`name`) VALUES ('$prayer','$prayer_name')");
$message = "<font color=\"#00CC66\">Thank you! Your prayer has been submitted and may be viewed <a href=\"view_prayers.php\">here</a></font>";}}
?>Code: Select all
if($prayer||$prayer_name==$expletives)
{$all_is_good = "no";
$message = "<font color=\"#FF0000\">Error: You are not allowed to use bad words!</font>";}the code for expletive_filter.php is as follows:
Code: Select all
<?PHP
$expletives = array("bad","words");
?>
Noah Keller
P.S. I have been trying all day to accomplish this, and I am rather new to PHP