• So heres the deal i want to use the javascript from adblockdetector.com to detect is anyone downloading files from my site has an adblocker.
    The only way i can figure out how to make everything work for the most part is by using iframe.

    Im using gravity forms with wordpress to upload the files using a custom field.

    this lets the file linked in the custom field to be a downloadable link

    <?php
    $customField = get_post_custom_values(“file_attachment”);
    if (isset($customField[0])) {
    echo ‘<h3>Download Now!</h3>’;
    } ?>

    I chose to use

    <?php
    $customField = get_post_custom_values(“file_attachment”);
    if (isset($customField[0])) {
    echo ‘<iframe style=”border:hidden; width:420px; height:220px;” src=”/pages/test.html”></iframe>’;
    } ?>

    once the iframe has been setup it either blocks the content from being downloaded or shows a download link after a timer.

    for the download link in the iframe when i try to call for
    <?php
    $customField = get_post_custom_values(“file_attachment”);
    if (isset($customField[0])) {
    echo ‘<h3>Download Now!</h3>’;
    } ?>

    the iframe tries to load a invalid page and not the file in the custom field.

    you can see what im working with on my site gfuzz.net/?p=110

    if there is a way i can combine all the code without using iframe that would be awesome.

    here are the files im using to make all of this work.

    Quote

    <?php
    $customField = get_post_custom_values(“file_attachment”);
    if (isset($customField[0])) {
    echo ‘<iframe style=”border:hidden; width:420px; height:220px;” src=”/pages/test.html”></iframe>’;
    } ?>

    calls to

    ><script type=”text/javascript” class=”iframe”>
    function _enabled() {
    document.write(‘Remove AdBlock to reveal content’);
    }
    function _disabled() {
    document.write(‘<iframe style=”border:hidden; width:400px; height:200px;” src=”/pages/code.html”></iframe>’);
    }
    var _abdDetectedFnc = ‘_enabled’;
    var _abdNotDetectedFnc = ‘_disabled’;
    </script>

    <script type=”text/javascript” src=”/js/adbd.js”></script>

    This script is whats detects if an adblock program is running then loads the code.html page once the adblock has been disabled

    code.html calls for a timer
    <script type=”text/javascript” src=”js/timer.js”></script>
    </head>
    <body>

    <script type=”text/javascript”>window.onload = CreateTimer(“timer”, 20);</script>
    <h2>Your code will be ready soon</h2>
    <h3>Thank you for choosing gFuzz</h3>
    after 20 seconds has past
    the timer loads dl.php

    thats where the
    <?php
    $customField = get_post_custom_values(“file_attachment”);
    if (isset($customField[0])) {
    echo ‘<h3>Download Now!</h3>’;
    } ?>

    was put

    the only issue i have is when i try to echo the file. it just tries to load a page
    as
    ‘.$customField[0].’.html

    i dont want this link to open a page i want it to link to the file i have in the custom field of the parent page.

    I tried to explain my situation as best i can if anyone can give me some pointers that would be great thank you.

  • The topic ‘php post download timer file block.’ is closed to new replies.