Help Implementing Banbuilder Cure Filter on PHP Site

Discussion in 'Programming' started by emgage, Jun 6, 2014.

  1. #1
    Hello everyone, this may be a simple question but honestly I have no idea what to do with it. I am trying to install the banbuilder script from banbuilder.com on my website. I have uplaoded all the neccessary files. The issue is when it comes to inserting

    $badwords = array();
    include('lang/en-us.wordlist-regex.php');
    include('lang/fr.wordlist-regex.php');
    include('lang/es.wordlist-regex.php');
    include('censor.function.php');
    $censored = censorString($input, $badwords);
    Code (markup):
    I have no idea where exactly to place this code into my website. Should it be inserted into a form or such? I tried inserting it just before the </head> and it shows up as the code text on my website so that definitely can't be it.

    Any help would be appreciated.

    Best
     
    emgage, Jun 6, 2014 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #2
    so long as the page that is running it can parse PHP you need this

    <?php
    $badwords = array();
    include('lang/en-us.wordlist-regex.php');
    include('lang/fr.wordlist-regex.php');
    include('lang/es.wordlist-regex.php');
    include('censor.function.php');
    $censored = censorString($input, $badwords);
    ?>
    Code (markup):
    the <?php and ?> tell the server to run the code in between, and not to treat it as plain text.
     
    sarahk, Jun 7, 2014 IP
  3. emgage

    emgage Well-Known Member

    Messages:
    126
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #3
    I've added this to the site
    <?php
    $badwords = array();
    include("../lang/en-us.wordlist-regex.php");
    include("../lang/fr.wordlist-regex.php");
    include("../lang/es.wordlist-regex.php");
    include("../censor.function.php");
    $censored = censorString($input, $badwords);
    ?>
    Code (markup):
    but for some reason it seems the site isn't doing anything. Bad words are still appearing unchanged. Not sure what the issue is.
     
    emgage, Jun 7, 2014 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Have you understood the installation instructions?

    Have you put some badwords in the $badwords array?
    Have you put your page text into $input?

    This isn't hard to do, but if you haven't taken the time to read the very simple instructions you could waste a lot of your time
     
    sarahk, Jun 7, 2014 IP
  5. emgage

    emgage Well-Known Member

    Messages:
    126
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #5
    The instructions only include adding the code to the site, which I had to modify slightly to point to the correct files without giving errors. The words in the badwords array should be the words in the files included eg. en-us.wordlist-regex.php, at least that's what I understand from it. How would I put my page text into input. I has attempted to open the php function with the code in my header and close it in the footer, to include the entire page's content for the different pages, but that doesn't work. Simply placing the code in the header doesn't work either.
     
    emgage, Jun 7, 2014 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #6
    If you've put the text on the site you shouldn't need to filter it.

    Lets say your site is a blog type site and people leave comments and the comments are what you are worried about

    As you loop through the comments and echo them out, just before you echo you'd pass it to
    $censored = censorString($comment, $badwords);
    Code (markup):
    and echo out $censored

    Maybe if you posted some of your code or gave a link to your site we might be able to help better.
     
    sarahk, Jun 7, 2014 IP
  7. emgage

    emgage Well-Known Member

    Messages:
    126
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #7
    Alright, so here are some exaples of things I'd like to have filtered.

    In my header.php file I have

    <?php
    $badwords = array();
    include("../lang/en-us.wordlist-regex.php");
    include("../lang/fr.wordlist-regex.php");
    include("../lang/es.wordlist-regex.php");
    include("../censor.function.php");
    $censored = censorString($PAGE_TITLE, $badwords);
    ?>
    Code (markup):
    The beginning of the file is

    <title><?php echo $PAGE_TITLE; ?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="description" content="<?php echo $PAGE_DESCRIPTION; ?>" />
        <meta name="keywords" content="<?php echo $PAGE_KEYWORDS; ?>" />
    Code (markup):
    So let's say I'm trying to censor the page title, I have used $censored = censorString($PAGE_TITLE, $badwords); as you can see in the code at the top which doesn't seem to work.

    Other examples of where I need it to apply the filter is in the image descriptions/titles on the actual page, such as the code below

    <div id="main-area">
                <div id="menu-module">
                    <div class="module-top"><h1><a href="<?php echo "/character/".$memeData['character_seo']; ?>"><?php echo $memeData[character_name]; ?></a></h1></div>
                    <div class="module-body" style="padding-bottom:5px;">
                    <div style="float:left;margin-top:-2px;width:780px;text-align:center;padding-bottom:8px;">
                    <font style="text-transform: uppercase; font-family: times; font-size:13px; font-weight:bold;" color="#3E3535"><?php echo htmlspecialchars_decode($memeData['meme_top_text']." ".$memeData['meme_bottom_text']); if($memeData['meme_char_id']>0) { echo " - ".$memeData[character_name]; } if($_SESSION['admin']) { echo "&nbsp;&nbsp;&nbsp;<a style='color:#ff0000;text-decoration:none;' id='adminDelete' rel='".$memeData[meme_id]."' href='javascript:;'>[delete]</a>"; } ?></font>
                    </div>
                        <div id="meme-page-data">
    Code (markup):
    As for the comments, I'm using facebook comments for the site with the following code

    <div id="menu-module">                <div class="module-top"><h1>Leave a comment!</h1></div>
                    <div class="module-body">
                        <div style="margin:0 10px;padding-bottom:8px;">
                            <div class="fb-comments" data-href="<?php echo curPageURL(); ?>" data-num-posts="4" data-width="800"></div>
                        </div>
                        <div style="clear:both;"></div>
                    </div>
                </div>
                <div id="menu-module">
    Code (markup):
    The site is http://memeshappen.com

    I would appreciate your suggestions on where to make the necessary modifications to get the filter to be effective.

    Kind Regards
     
    emgage, Jun 7, 2014 IP
  8. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #8
    Lets try this...

    <?php
    $badwords = array();
    include("../lang/en-us.wordlist-regex.php");
    include("../lang/fr.wordlist-regex.php");
    include("../lang/es.wordlist-regex.php");
    include("../censor.function.php");
    $censoredTitle = censorString($PAGE_TITLE, $badwords);
    $censoredDescription = censorString($PAGE_DESCRIPTION, $badwords);
    $censoredKeywords = censorString($PAGE_KEYWORDS, $badwords);
    ?>
    <title><?php echo $censoredTitle; ?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="description" content="<?php echo $censoredDescription; ?>" />
        <meta name="keywords" content="<?php echo $censoredKeywords; ?>" />
    Code (markup):
     
    sarahk, Jun 7, 2014 IP
  9. emgage

    emgage Well-Known Member

    Messages:
    126
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #9
    I gave that a try. For some reason all the titles now display as "Array"
     
    emgage, Jun 8, 2014 IP
  10. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #10
    OK, do a var_dump of the array and see what should be echo'd
     
    sarahk, Jun 8, 2014 IP
  11. emgage

    emgage Well-Known Member

    Messages:
    126
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #11
    Adding var_dump($badwords); (if that's what you meant) displays the following above the fold

    array(191) { [0]=> string(4) "anal" [1]=> string(4) "anus" [2]=> string(3) "ass" [3]=> string(7) "bastard" [4]=> string(5) "bitch" [5]=> string(4) "boob" [6]=> string(4) "cock" [7]=> string(3) "cum" [8]=> string(4) "cunt" [9]=> string(4) "dick" [10]=> string(5) "dildo" [11]=> string(4) "dyke" [12]=> string(3) "fag" [13]=> string(6) "faggot" [14]=> string(4) "fuck" [15]=> string(3) "fuk" [16]=> string(7) "handjob" [17]=> string(4) "homo" [18]=> string(4) "jizz" [19]=> string(4) "kike" [20]=> string(4) "kunt" [21]=> string(4) "muff" [22]=> string(6) "nigger" [23]=> string(5) "penis" [24]=> string(4) "piss" [25]=> string(4) "poop" [26]=> string(5) "pussy" [27]=> string(5) "queer" [28]=> string(4) "rape" [29]=> string(5) "semen" [30]=> string(3) "sex" [31]=> string(4) "shit" [32]=> string(4) "slut" [33]=> string(7) "titties" [34]=> string(4) "twat" [35]=> string(6) "vagina" [36]=> string(5) "vulva" [37]=> string(4) "wank" [38]=> string(8) "abortion" [39]=> string(4) "anus" [40]=> string(11) "beastiality" [41]=> string(10) "bestiality" [42]=> string(4) "bewb" [43]=> string(4) "blow" [44]=> string(8) "blumpkin" [45]=> string(4) "cawk" [46]=> string(5) "choad" [47]=> string(6) "cooter" [48]=> string(8) "cornhole" [49]=> string(4) "dong" [50]=> string(6) "douche" [51]=> string(4) "fart" [52]=> string(8) "foreskin" [53]=> string(8) "gangbang" [54]=> string(4) "gook" [55]=> string(4) "hell" [56]=> string(6) "honkey" [57]=> string(7) "humping" [58]=> string(3) "jiz" [59]=> string(5) "labia" [60]=> string(7) "nutsack" [61]=> string(5) "pen1s" [62]=> string(4) "poon" [63]=> string(6) "punani" [64]=> string(5) "queef" [65]=> string(4) "quim" [66]=> string(6) "rectal" [67]=> string(6) "rectum" [68]=> string(6) "rimjob" [69]=> string(5) "spick" [70]=> string(4) "spoo" [71]=> string(6) "spooge" [72]=> string(5) "taint" [73]=> string(5) "titty" [74]=> string(3) "vag" [75]=> string(5) "whore" [76]=> string(6) "abruti" [77]=> string(7) "abrutie" [78]=> string(5) "baise" [79]=> string(6) "baisé" [80]=> string(6) "baiser" [81]=> string(6) "batard" [82]=> string(4) "bite" [83]=> string(8) "bougnoul" [84]=> string(8) "branleur" [85]=> string(5) "burne" [86]=> string(5) "chier" [87]=> string(4) "cocu" [88]=> string(3) "con" [89]=> string(7) "connard" [90]=> string(8) "connasse" [91]=> string(5) "conne" [92]=> string(7) "couille" [93]=> string(8) "couillon" [94]=> string(10) "couillonne" [95]=> string(7) "crevard" [96]=> string(3) "cul" [97]=> string(6) "encule" [98]=> string(7) "enculé" [99]=> string(7) "enculee" [100]=> string(8) "enculée" [101]=> string(7) "enculer" [102]=> string(7) "enfoire" [103]=> string(8) "enfoiré" [104]=> string(4) "fion" [105]=> string(6) "foutre" [106]=> string(5) "merde" [107]=> string(5) "negre" [108]=> string(6) "nègre" [109]=> string(8) "negresse" [110]=> string(9) "négresse" [111]=> string(5) "nique" [112]=> string(6) "niquer" [113]=> string(8) "partouze" [114]=> string(2) "pd" [115]=> string(4) "pede" [116]=> string(6) "pédé" [117]=> string(7) "petasse" [118]=> string(8) "pétasse" [119]=> string(4) "pine" [120]=> string(6) "pouffe" [121]=> string(10) "pouffiasse" [122]=> string(6) "putain" [123]=> string(4) "pute" [124]=> string(6) "salaud" [125]=> string(5) "salop" [126]=> string(8) "salopard" [127]=> string(6) "salope" [128]=> string(7) "sodomie" [129]=> string(5) "sucer" [130]=> string(7) "tapette" [131]=> string(4) "tare" [132]=> string(5) "taré" [133]=> string(5) "vagin" [134]=> string(3) "zob" [135]=> string(7) "bollera" [136]=> string(6) "cabron" [137]=> string(7) "cabrón" [138]=> string(7) "cabrona" [139]=> string(9) "cabronazo" [140]=> string(7) "capulla" [141]=> string(7) "capullo" [142]=> string(6) "chichi" [143]=> string(6) "chocho" [144]=> string(5) "cojon" [145]=> string(6) "cojón" [146]=> string(7) "cojones" [147]=> string(10) "comepollas" [148]=> string(4) "cono" [149]=> string(5) "coño" [150]=> string(4) "culo" [151]=> string(6) "follar" [152]=> string(6) "follen" [153]=> string(6) "furcia" [154]=> string(10) "gilipollas" [155]=> string(8) "hijaputa" [156]=> string(9) "hijo puta" [157]=> string(8) "hijoputa" [158]=> string(6) "hostia" [159]=> string(5) "joder" [160]=> string(6) "jodete" [161]=> string(7) "jódete" [162]=> string(6) "joputa" [163]=> string(6) "mamada" [164]=> string(5) "mamon" [165]=> string(6) "mamón" [166]=> string(6) "mamona" [167]=> string(6) "marica" [168]=> string(7) "maricon" [169]=> string(8) "maricón" [170]=> string(8) "maricona" [171]=> string(10) "mariconazo" [172]=> string(4) "nazi" [173]=> string(5) "ojete" [174]=> string(5) "ostia" [175]=> string(9) "pajillero" [176]=> string(6) "pendon" [177]=> string(7) "pendón" [178]=> string(5) "picha" [179]=> string(5) "polla" [180]=> string(6) "pollon" [181]=> string(7) "pollón" [182]=> string(5) "polvo" [183]=> string(7) "potorro" [184]=> string(4) "puta" [185]=> string(4) "puto" [186]=> string(5) "puton" [187]=> string(6) "putón" [188]=> string(10) "tortillera" [189]=> string(6) "zorron" [190]=> string(7) "zorrón" } 
    Code (markup):
     
    emgage, Jun 8, 2014 IP
  12. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #12
    No, I meant of the variable that you are echo'ing out - the one that you have said just echo's out "array"
     
    sarahk, Jun 8, 2014 IP