V4.1.x Bad Word filter

Discussion in 'Modules / Plugins / Modifications' started by danth6961, May 4, 2010.

  1. danth6961 Customer

    What version of 68 Classifieds are you running?
    V 4.1.10 Developer

    Hey guys here is what I was thinking. I have a pretty long list of bad words that I want to filter for and tbh I don't really want to hand jam them all into the database. So here is what I was thinking.

    include "connect.php";

    if(isset($_POST['submit']))

    {
    $filename=$_POST['filename'];

    $forbidden = fopen("$filename", "r");

    while (($data = fgets($forbidden)) !== FALSE)

    {
    $import="INSERT into "TABLE"("field1","field2")values('$data[0]','Quagmire')";

    mysql_query($import) or die(mysql_error());
    }

    fclose($forbidden);
    print "Import done";

    }

    else

    {
    print "<form action='import.php' method='post'>";

    print "Type file name to import:<br>";

    print "<input type='text' name='filename' size='20'><br>";

    print "<input type='submit' name='submit' value='submit'></form>";
    }

    Any inputs or better ideas would be greatly appreciated.
  2. Mike-N-Tosh Developer & Moderator

    I'm still a rookie with all of the php stuff and may be talking out my [badword filter = 'ON'] &$#!, but wouldn't you need to 'explode' the file to import it first?

    If you already have your list in a CSV, why don't you simply import it into the table with phpmyadmin?
  3. danth6961 Customer

    LOL you think you're a rookie with php. This is honestly my first foray into the unix world. I have been a windows sys admin my entire career.

    Any way I put the starter code up there and figured we could collaborate. Anyone can ad to it.

    This isn't a CSV its a straight text file. Evey bad word will be replace with quagmire or your word of choice. Now we could do a fgetcsv and put two colums in so that you could have every bad word have a new and interesting word.

    and as far as phpamin goes... see there's that second part about a better idea.

Share This Page