Hi everyone,

My first post here. I want to delete the kontera code from all my php files.

All of the php files are located in the one folder (not in any sub-folders either).

I want to use a PHP script to detect all the php files in that folder, open it to find the Kontera code & delete it..

The code I want to delete is this:

<!-- Kontera ContentLink™ -->
<script type="text/javascript">
var dc_UnitID = 14;
var dc_PublisherID = xxxxxx;
var dc_AdLinkColor = 'blue';
var dc_isBoldActive= 'no';
var dc_adprod='ADL';
</script>
<script type="text/javascript"
SRC="http://kona.kontera.com/javascript/lib/KonaLibInline.js"></script>
<!-- Kontera ContentLink™ -->

and it's identical on every page.

Thanks in advance!

-Richard

    Ok, firstly do you want to do this once, or dynamically every time these pages are loaded - if you do want it every time the pages are loaded it would put a considerable abount of pressure on your server to just delete code

    -- more info needed...

    -- this isnt a noob script its pretty technical -- also tell me if you want it in class form or not

    could everyone $_GET[ up2date] on PHP5 classes...

      Doesn't sound like it'd be too complicated... heck, you could even do it in no more than two lines:

      foreach(glob('dir-to-scan/*.php') as $file)
          file_put_contents($file, preg_replace('/<!-- Kontera ContentLink™ -->.*?<!-- Kontera ContentLink™ -->/s', '', file_get_contents($file)));
        Write a Reply...