Here is the code with the bad words left in them. Feel free to use this if you are creating a teen site or something. Massive ups to Chris E. and Nobbie for some ideas. Nobbie, you need to place it in a certian position for it to read the word. After it hits the false; statment it will clear the variables (I think) and therefore had nothing to display. So if you put it in there at the beginning it will print then clear. Darn you still have it printed though. So here is the script for it!
-------Bad words...Sorry -------------
<?
function checkBadWords($thought_thought) {
$badWords = array('@!#$', 'cunt', 'whore','hoe','gay','homosexual','homo','gayism','faggot','lesbian','lesbo','lessie','lessy','chad smith','melanie perry','chris crothers','matt brainard','flaming','porno','stupid','slut','g a y','pics','pictures','7180 cheshire rd.','butt','ass','bastard','dick','dike','crack','pipe','mary j','pcp','alcohol','corona','budweiser','speed','drugs','druggie','drugy','shot','heneiken','beer','151','loser','penis','vagina','fucker','fuckster','fucking','fuckalot','fuckingman','@!#$','@$$','hole','fker','cuntbreaker','butthole','butt','butts','jackass','jack whore','f u c k','f uc k','fu ck','fu','fk','a s s','as s','fuc k','f uck','fkuc','nieps','hunter','holman','thompson','damn','Mr. Hunter','Mr. Holman','Mr. thompson','mr.hunter','mr.holman','mr.thompson','staff','administration','@!#$','$hit','mother fucker','mother fuckster','mother @!#$','mother ass hole','@!#$','bull','bull @!#$');
foreach ($badWords as $badWord) {
if (eregi($badWord, $thought_thought)) {
$theword = $badWord;
print("<h1>Bad Word Is: $theword</h1>");
return false;
}
}
return true;
}
if (!checkBadWords($thought_thought)) {
print("<h1>You used the word $theword...Which is bad! Try again!</h1>");
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>");
?>
-----------Thats all----------