1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Ads will not show

Discussion in 'Co-op Advertising Network' started by kokopoko, Dec 9, 2004.

  1. #1
    I am running an .html site. .htaccess has been modified to server parse .html and .inc files. SSI does work on the pages.
    <!--#echo var="DATE_LOCAL" --> 
    Code (markup):
    does work on the page. I do not believe I have mod rewrite enabled as I tried the method in another thread of using mod rewrite and passthru.php. The test page I am using is http://www.1stop-satellite-radio.com/xmradio.html I will get the code working here and then put it on all pages.

    Any ideas as what to try?
     
    kokopoko, Dec 9, 2004 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    If that SSI function works, but not the virtual include, then it's mostly likely a configuration issue with the server itself.
     
    digitalpoint, Dec 9, 2004 IP
  3. kokopoko

    kokopoko Active Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    The odd thing is that where the include for ad_network file shows the php code, but only part of the code. The code that shows on the page is below.
    
    ', $ads); if (count ($ads) < 401 || $ads[0] + 900 < time()) { $new_ad = file_get_contents ('http://ads.digitalpoint.com/network.php?s=' . $_SERVER['SERVER_NAME'] . '&type=link'); $ads[] = $new_ad; $ads[0] = time(); if (count ($ads) > 401) unset ($ads[1]); if ($new_ad) { $file = fopen($ad_file, 'w'); fwrite ($file, implode ('', $ads)); fclose ($file); } $ad = end ($ads); } else { $ad = $ads[rand(1,count($ads) - 1)]; } $ad_network[] = $ad; while (count ($ad_network) < 5) { $ad_network[] = $ads[rand(1,count($ads) - 1)]; } } 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):
    Why would only part of the code from that php file show? And why is it showing at all?
     
    kokopoko, Dec 9, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    Not sure... does your server support PHP?
     
    digitalpoint, Dec 9, 2004 IP
  5. kokopoko

    kokopoko Active Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #5
    I'm including another php file right above the ad network.php file. The other php include is working fine.
     
    kokopoko, Dec 9, 2004 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #6
    If you look at the source of the ad_network.php file, is everything there? Opening PHP tags and all?
     
    digitalpoint, Dec 9, 2004 IP
  7. kokopoko

    kokopoko Active Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #7
    Yup. Here it is:
    <?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);
    
    if (count ($ads) < 401 || $ads[0] + 900 < time()) {
    $new_ad = file_get_contents ('http://ads.digitalpoint.com/network.php?s=' . $_SERVER['SERVER_NAME'] . '&type=link');
    $ads[] = $new_ad;
    $ads[0] = time();
    if (count ($ads) > 401) unset ($ads[1]);
    if ($new_ad) {
    $file = fopen($ad_file, 'w');
    fwrite ($file, implode ('<ad_break>', $ads));
    fclose ($file);
    }
    $ad = end ($ads);
    } else {
    $ad = $ads[rand(1,count($ads) - 1)];
    }
    $ad_network[] = $ad;
    while (count ($ad_network) < 5) {
    $ad_network[] = $ads[rand(1,count($ads) - 1)];
    }
    } 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):
     
    kokopoko, Dec 9, 2004 IP
  8. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #8
    If you access the ad_network.php file directory, do you get an error? (It should be a blank window with nothing in the source)
     
    digitalpoint, Dec 9, 2004 IP
  9. kokopoko

    kokopoko Active Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #9
    Doesn't work. The browser tries to save it to a disk or find an application to open it. Here's my .htaccess

    Options +Includes
    AddType text/html .html .inc 
    AddHandler server-parsed .html .inc .php 
    options -Indexes
    Code (markup):
    And here's the location www.1stop-satellite-radio.com/ad_network.php
     
    kokopoko, Dec 9, 2004 IP
  10. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #10
    Hmmm... well definitely remove php from the server-parsed line...
     
    digitalpoint, Dec 9, 2004 IP
  11. kokopoko

    kokopoko Active Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #11
    Ok we're moving along! Now I get this error: Fatal error: [] operator not supported for strings in /ad_network.php on line 35

    The code for that line is
    $ads[ ] = $new_ad;
    Code (markup):
     
    kokopoko, Dec 9, 2004 IP
  12. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #12
    Your version of PHP doesn't support arrays??? Never heard of that one.
     
    digitalpoint, Dec 9, 2004 IP
  13. kokopoko

    kokopoko Active Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #13
    Php isn't the problem though it was choking on that line. I had to delete the lines around it and retype it back in and now no error message but no ads, it's just blank. There seems to be an ad sitting in the ad network text file though but it's not showing up.
     
    kokopoko, Dec 9, 2004 IP
  14. kokopoko

    kokopoko Active Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #14
    I read another thread discussing ads not showing and put this
    echo $ad_network[0]; 
    Code (markup):
    at the bottom of the ad network php and guess what. It works!
     
    kokopoko, Dec 9, 2004 IP