I want to display only text ads

Discussion in 'Co-op Advertising Network' started by seattlecane, Jan 7, 2005.

  1. #1
    I have searched but can't seem to find how to do it.

    Sometimes the ads come thru as just text but sometimes I get the text banner or an actual banner image. I just want text links and that is it.

    here is the site to see what i am talking about http://thecollegegridiron.com/boards

    Here are my settings

    ad_network.php
    <?php
    
            if (!function_exists('file_get_contents')) {
                    function file_get_contents($url) {
                            $handle = fopen($url, 'r');
                            $string = fread($handle, 4096000);
                            fclose($handle);
                            return $string;
                    }
            }
    
            if (!function_exists('make_seed')) {
                    function make_seed() {
                            list($usec, $sec) = explode(' ', microtime());
                            return (float) $sec + ((float) $usec * 100000);
                    }
                    srand (make_seed());
            }
    
            if (!isset($_SERVER)) $_SERVER = $HTTP_SERVER_VARS;
    
            $ad_file = 'ad_network_ads.txt';
            for ($i = 0; $i <= 11; $i++) {
                    $p = substr ('../../../../../../../../../../', 0, $i * 3);
                    if (file_exists ($p . $ad_file)) {
                            $ad_file = $p . $ad_file;
                            break;
                    }
            }
    
            if (is_writable ($ad_file)) {
                    $ads = file_get_contents ($ad_file);
                    $ads = explode ('<ad_break>', $ads);
                    $ads_temp = explode ('|', $ads[0]);
    
                    if ((count ($ads) < $ads_temp[3] + 1 && $ads_temp[0] + $ads_temp[5] < time()) || $ads_temp[0] + $ads_temp[4] < time()) {
                            $new_ad = file_get_contents ('http://ads.digitalpoint.com/network.php?b=' . $_SERVER['SERVER_NAME'] . '&type=link');
                            if ($new_ad) {
                                    $ads_param = explode ('<ad_param>' , $new_ad);
                                    $new_ad = $ads_param[1];
                                    unset ($ads_param[1]);
                                    $ads_temp = explode ('|', $ads_temp[0] . '|' . $ads_temp[1] . '|' . $ads_param[0]);
                            } else {
                                    $ads_param = array_slice ($ads_temp, 2, 4);
                            }
                            $ads[0] = time() . '|' . gethostbyname('validate.digitalpoint.com') . '|' . implode ('|', $ads_param);
                            if ($new_ad) {
                                    $ads[] = $new_ad;
                                    if (count ($ads) > $ads_temp[3] + 1) $ads = array_merge ($ads[0], array_slice ($ads, -$ads_temp[3]));
                            }
                            $file = fopen($ad_file, 'r+');
                            if (flock ($file, LOCK_EX)) {
                                    fwrite ($file, implode ('<ad_break>', $ads));
                                    ftruncate ($file, ftell($file));
                                    flock ($file, LOCK_UN);
                            }
                            fclose ($file);
                            $ad = $new_ad;
    
                    } else {
                            $ad = $ads[rand(1,count($ads) - 1)];
                    }
                    $ad_network[] = $ad;
                    while (count ($ad_network) < 5) {
                            $ad_network[] = $ads[rand(1,count($ads) - 1)];
                    }
                    foreach ($ad_network as $key => $ad) {
                            if ($ads_temp[1] == $_SERVER['REMOTE_ADDR'] || $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR']) {
                                    $ad_network[$key] = str_replace ('" />', '" class="' . $ads_temp[2] . '" />', $ad);
                            } else {
                                    $ad_network[$key] = str_replace ('" />', '">', $ad);
                            }
                    }
            } else {
                    $ad_network[] = 'You must set the "ad_network_ads.txt" file to be writable.';
            }
            if (substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.shtml') {
                    ini_set ('zlib.output_compression', 0);
                    echo end ($ad_network);
            }
    
    ?>
    Code (markup):
    page_tail.php
    include ($phpbb_root_path . 'ad_network.php');
    $template->assign_vars(array('AD_NETWORK' => $ad_network[0]));
    $template->assign_vars(array('AD_NETWORK1' => $ad_network[1]));
    $template->assign_vars(array('AD_NETWORK2' => $ad_network[2]));
    $template->assign_vars(array('AD_NETWORK3' => $ad_network[3]));
    $template->assign_vars(array('AD_NETWORK4' => $ad_network[4]));
    Code (markup):
    overall_footer.tpl
    <center> Visit {AD_NETWORK} | {AD_NETWORK1} | {AD_NETWORK2} | {AD_NETWORK3} | {AD_NETWORK4} </center>
    Code (markup):
    Can someone help me out? Thanks.
     
    seattlecane, Jan 7, 2005 IP
  2. a389951l

    a389951l Must Create More Content

    Messages:
    1,885
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    140
    #2
    I looks like you need to flush out the ad_network_ads.txt.
     
    a389951l, Jan 7, 2005 IP
    seattlecane likes this.
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    You can flush your ad_network_ads.txt file... if you were running banners (intentionally or accidentally) for a period of time, they are probably still in your cache fie.
     
    digitalpoint, Jan 7, 2005 IP
    seattlecane likes this.
  4. seattlecane

    seattlecane Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thanks very much, all is working now!
     
    seattlecane, Jan 7, 2005 IP