Hi All,
I had this working and messed it up somehow. I am trying to filter out certain words before posting to the message board and I get nothing from the post. Here is my code:
$comment=$_POST['comment'];
if(!$name || !$comment)
{
print "<font color='red'>Name or comment not entered, please go back and sign again</font><br>";
}
else
{
// Filter out the bad content
$Keyword = (isset($_GET['comment'])) ? $_GET['comment'] : '';
$trimmedKeyword = trim($Keyword);
$trimmedKeyword = stripslashes($trimmedKeyword);
//filter special characters such as % ^ &
$filter = array("`","~", "\"" , "\\" , "!", "@" , "#" , "$" , "%" , "^" , "&" , "*" , "(", ")" , "+" , "{" , "}" , "[" , "]" , "<" , ">" , ";" , ":" , "?" , "/" ,"//" , "|");
$trimmedKeyword = str_replace($filter, '', $trimmedKeyword);
//trim whitespace from the stored variable : '/\s+/s --> to remove any additional spaces.
$trimmedKeyword = preg_replace('#\s+#',' ',$trimmedKeyword);
$trimmed_arrayKeyword = explode(" ",$trimmedKeyword);
// Insert data
$putinguestbook="INSERT INTO gbook(name, country, mail, homepage, comment, realtime, aim, icq, yim, msn, time,IP) VALUES('$name','$country','$email','$homepage','$trimmedKeyword','$day','$aim','$icq','$yim','$msn','$timegone','$r')";
I am stumped.
Thanks in advance,
Don