Hi, me again, having another error. I need a anti-swear feature. Here is my non-working code:
<?php
if (isset($_POST["name"], $_POST["text"])) {
$contents = strip_tags($_POST["name"]) . ' : '
. strip_tags($_POST["text"]) . "<br>";
$data = file('filter.txt');
foreach($file as $val){
$ding = explode('!', $ding);
$contents = str_ireplace($ding[0], $ding[1], $_POST['text']);
}
if (file_put_contents("comments.txt", $contents, FILE_APPEND) === false) {
die("Robbit Shout is down, try again later.");
}
}
echo file_get_contents("comments.txt");
?>
The error: "Notice: Undefined variable: file in /www/sitegoz.com/p/a/r/partypad/htdocs/index.php on line 53
Warning: Invalid argument supplied for foreach() in /www/sitegoz.com/p/a/r/partypad/htdocs/index.php on line 53"
The contents of "filter.txt":
"SWEARWORD!****" ... etc
Please help?