Hey I have this source code below and it works like a charm! Thanks Chris E.! But one thing about it.... I want it to tell the user what word that it just doesn't accept. I cut out all the words (little kids in the forum) but just let me know how I can go about it. Oh and thought_thought is the text the user inputs. Which comes from a seperate form. So don't worry bout that. Thanks!
<?
function checkBadWords($thought_thought) {
$badWords = array('the','and','chili');
foreach ($badWords as $badWord) {
if (eregi($badWord, $thought_thought)) {
return false;
}
}
return true;
}
if (!checkBadWords($thought_thought)) {
print("<h1>You Kiss Your Mother With Those Lips!</h1>");
print("<h3>Bad Language! Keep it down!</h3>");
print("<meta http-equiv='refresh' content='3; url=randomthoughts.php'>");
print("</head><body><a href='randomthoughts.php'><font face='arial,helvetica'><b>If it does not come up. Please click here. This will take you back.</b></font></a></body>");
exit;
}
$db = mysql_connect("localhost");
mysql_select_db("olentangy", $db);
$sql = "INSERT INTO thought
VALUES(NULL,'$thought_name','$thought_grade','$thought_thought')";
mysql_query($sql);
?>
<?php
print("<meta http-equiv='refresh' content='1; url=randomthoughts.php'>");
print("</head><body><a href='randomthoughts.php'><font face='arial,helvetica'><b>If it does not come up. Please click here. This will take you back.</b></font></a></body>");
?>
Thanks!
Chad