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 - Same ad 5 times

Discussion in 'Co-op Advertising Network' started by joeychgo, Dec 11, 2004.

  1. #1
    I just got a friend to sign up - but he is showing the same ad 5 times --




    http://www.gmvsford.com/forums/ at the very bottom of the page. Yes - refreshed the page -- this is the code he placed at the footer -

    $ad_network[0] $ad_network[1] $ad_network[2] $ad_network[3] $ad_network[4]



    this is the same code I have on mine in the exact same place.....



    +????
     
    joeychgo, Dec 11, 2004 IP
  2. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #2
    Did you try this:

    include ('ad_network.php');
    echo (''.$ad_network[0].','.$ad_network[1].','.$ad_network[2].','.$ad_network[3].','.$ad_network[4].'');
     
    ResaleBroker, Dec 11, 2004 IP
  3. joeychgo

    joeychgo Notable Member

    Messages:
    3,368
    Likes Received:
    321
    Best Answers:
    0
    Trophy Points:
    255
    #3
    where??? take a look -- he added that code in the footer....
     
    joeychgo, Dec 11, 2004 IP
  4. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #4
    That wasn't the full code. Try this:

    <?php
    ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../');
    include ('ad_network.php');
    echo (''.$ad_network[0].','.$ad_network[1].','.$ad_network[2].','.$ad_network[3].','.$ad_network[4].'');
    ?>

    Even better:

    <?php
    ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../');
    include ('ad_network.php');
    echo implode (', ', $ad_network); ?>
     
    ResaleBroker, Dec 11, 2004 IP
  5. joeychgo

    joeychgo Notable Member

    Messages:
    3,368
    Likes Received:
    321
    Best Answers:
    0
    Trophy Points:
    255
    #5
    its important to note - everything on his server is .php3 for some reason
     
    joeychgo, Dec 11, 2004 IP
  6. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #6
    I sent you a PM with a "possible" solution.
     
    ResaleBroker, Dec 11, 2004 IP
  7. joeychgo

    joeychgo Notable Member

    Messages:
    3,368
    Likes Received:
    321
    Best Answers:
    0
    Trophy Points:
    255
    #7
    I dont know if the ad_network.php file has to be different - he just renamed it ad_network.php3

    Does the code need to be different?
     
    joeychgo, Dec 11, 2004 IP
  8. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #8
    Shawn, what needs to be changed to have the script run with php3?
     
    ResaleBroker, Dec 11, 2004 IP
  9. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I believe you have to include ad_network.php once for every ad you want to show (right before you show it) if you're using the old code. Make sure you've got the newest ad_network.php
     
    exam, Dec 11, 2004 IP
  10. joeychgo

    joeychgo Notable Member

    Messages:
    3,368
    Likes Received:
    321
    Best Answers:
    0
    Trophy Points:
    255
    #10
    we both ahve the same forum software - vbulletin -- and this code, in my footer, works fine for me but doesnt work for him


    $ad_network[0] $ad_network[1] $ad_network[2] $ad_network[3] $ad_network[4]


    Thats exactly how mine is and it works fine ??
     
    joeychgo, Dec 11, 2004 IP
  11. joeychgo

    joeychgo Notable Member

    Messages:
    3,368
    Likes Received:
    321
    Best Answers:
    0
    Trophy Points:
    255
    #11
    anyone? Any thoughts?
     
    joeychgo, Dec 12, 2004 IP
  12. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Did you try what was suggested here? What was the outcome?

    He shouldn't have to rename it but if he has then you need to rename the include as well. Show us the full code (similar to what other's cut and paste above) and we will be able to help you better. With full <?php tags etc. please.
     
    T0PS3O, Dec 12, 2004 IP
  13. joeychgo

    joeychgo Notable Member

    Messages:
    3,368
    Likes Received:
    321
    Best Answers:
    0
    Trophy Points:
    255
    #13
    its the full code shown on the setup page

    <?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, 'r+');
    				if (flock ($file, LOCK_EX)) {
    					fwrite ($file, implode ('<ad_break>', $ads));
    					ftruncate ($file, ftell($file));
    					flock ($file, LOCK_UN);
    				}
    				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);
    	}
    
    ?>
    PHP:
     
    joeychgo, Dec 12, 2004 IP
  14. flawebworks

    flawebworks Tech Services

    Messages:
    991
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    78
    #14
    Find out exactly what version of php is being used. The php3 extension is older than my grandma. If it's a newer version of php; he should be able to use either the php3 extension or php extension.
     
    flawebworks, Dec 12, 2004 IP
  15. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #15
    What's the echo and include code in that displays the ads?
     
    T0PS3O, Dec 12, 2004 IP
  16. joeychgo

    joeychgo Notable Member

    Messages:
    3,368
    Likes Received:
    321
    Best Answers:
    0
    Trophy Points:
    255