Thread: Bad word filter
View Single Post
Join Date: Nov 2008
Posts: 4
Reputation: bigginge is an unknown quantity at this point 
Solved Threads: 0
bigginge bigginge is offline Offline
Newbie Poster

Re: Bad word filter

 
0
  #3
Nov 6th, 2008
Thank you so much. I put it here:
  1. // Print this only when there aren't any more entries..
  2. if($_GET['NumLow'] > $numallComments) {
  3. print 'No More Entries!&';
  4. }
  5. break;
  6.  
  7. case 'write' :
  8. // Recieve Variables From Flash
  9. $name = ereg_replace("&", "%26", $_POST['yourname']);
  10. $email = ereg_replace("&", "%26", $_POST['youremail']);
  11. $comments = ereg_replace("&", "%26", $_POST['yourcomments']);
  12. $submit = $_POST['submit'];
  13. $bad_words = explode('|', 'badword1|badword2|badword3|etc|etc');
  14. foreach ($bad_words as $naughty)
  15. {
  16. $comments = eregi_replace($naughty, "#!@%*#", $comments);
  17. }
  18. // Current system date in yyyy-mm-dd format
  19. $submitted_on = date ("Y-m-d H:i:s",time());
  20.  
  21. // Check if its submitted from Flash
  22. if($submit == 'Yes'){
  23. // Insert the data into the mysql table
  24. $sql = 'INSERT INTO ' . $table .
  25. ' (`ID`,
  26. `name`,
  27. `email`,
  28. `comments`,
  29. `time`
  30. )
  31. VALUES
  32. (\'\','
  33. . '\'' . $name . '\','
  34. . '\'' . $email . '\','
  35. . '\'' . $comments . '\','
  36. . '\'' . $submitted_on . '\'
  37. )';

and it worked a treat. I did alter badword1 etc. with real words. Now just need to sit down and think of the worst words I can.
Marvellous, you're a star.
Reply With Quote