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.

Help getting started?

Discussion in 'Co-op Advertising Network' started by mattmdesign, Nov 14, 2004.

  1. #1
    Hi,
    I set the ads up on 1 page of my site so far (will put it on the rest once I get it right), but it is showing this above the ads:

    Notice: Undefined index: DOCUMENT_NAME in D:\WWW\Matt_Martin\www_mattmdesign_com\ad_network.php on line 34

    I have absolutely no knowledge of PHP.. can someone help me out?
    Thanks, Matt
     
    mattmdesign, Nov 14, 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
    Make a PHP script with the following:

    <?php
    phpinfo();
    ?>
    PHP:
    Do you have a DOCUMENT_NAME variable listed in there?
     
    digitalpoint, Nov 15, 2004 IP
  3. mattmdesign

    mattmdesign Well-Known Member

    Messages:
    1,201
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    118
    #3
    Hi,
    I'm not sure I understand. I created a file called "document_name.php" with the code that you posted but it didn't change anything (I guess that isn't what you meant to do).
    There is "Document_Name" in the ad_network.php file. I just copied it and pasted it like it said, so it looks like this:

    <?php
    
    	$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) < 101 || $ads[0] + 3600 < time()) {
    			$new_ad = file_get_contents ('http://ads.digitalpoint.com/network.php');
    			$ads[] = $new_ad;
    			$ads[0] = time();
    			if (count ($ads) > 101) 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 . '<!-- an-hl -->';
    	} 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);
    	}
    
    ?>
    PHP:
     
    mattmdesign, Nov 15, 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
    If you aren't using SSI, you could remove the following:

    if (substr ($_SERVER['DOCUMENT_NAME'], -6) == '.shtml') { 
            ini_set ('zlib.output_compression', 0); 
            echo end ($ad_network); 
        }
    PHP:
     
    digitalpoint, Nov 15, 2004 IP
  5. mattmdesign

    mattmdesign Well-Known Member

    Messages:
    1,201
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    118
    #5
    Alright, its working fine now that I took that section out.
    Thanks!
     
    mattmdesign, Nov 15, 2004 IP