code problem

Discussion in 'Co-op Advertising Network' started by shamrock36, Jan 9, 2008.

  1. #1
    ive just opened an account,

    i've added the <!--#include virtual="/ad_network_131.php" -->
    line to my website, which is an addon domain. but i don't see any ads...

    the addon domain doesn't have its own .htaccess, i guess its using the root domain's .htaccess, that says:

    -FrontPage-


    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*


    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AddHandler server-parsed .shtml
    AddHandler server-parsed .html




    I didn't add the AddType application/x-httpd-php .php .htm .html
    to the .htaccess, because when i added this line something got screwed up - when i tried afterwards to access my site, the browser would ask me to download some file...

    so what do i do?
     
    shamrock36, Jan 9, 2008 IP
  2. shamrock36

    shamrock36 Active Member

    Messages:
    180
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #2
    can anyone help me with this:

    here is everything again:

    I have a website in html only, the server is handling all html files as .shtml files,

    1. this is my .htaccess code:

    AddHandler application/x-httpd-php .php .htm .html
    AddHandler server-parsed .shtml .html .htm


    2. I have a blank ad_network_ads_133.txt file

    3. and a ad_network_133.php

    that says:

    <?php
    // Last update: July 10, 2006 3:10 pm (PST)

    function file_get_contents_an($url) {
    if (substr ($url, 0, 7) == 'http://') {
    $url = parse_url ($url);
    if ($handle = @fsockopen ($url['host'], 80)) {
    fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
    while (!feof($handle)) {
    $string .= @fread($handle, 40960);
    }
    $string = explode ("
    ", $string);
    $string = array_pop ($string);
    }
    } else {
    $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);
    }
    mt_srand (make_seed());
    }

    if (!isset($_SERVER)) $_SERVER = $HTTP_SERVER_VARS;

    $ad_file = 'ad_network_ads_133.txt';
    for ($i = 0; $i <= 11; $i++) {
    $path = substr ('../../../../../../../../../../', 0, $i * 3);
    if (file_exists ($path . $ad_file)) {
    $ad_file = $path . $ad_file;
    break;
    }
    }

    if (is_writable ($ad_file)) {
    $ad_network = array();
    $ads = file_get_contents_an ($ad_file);
    $ads = explode ('<ad_break>', $ads);
    $ads_temp = explode ('|', $ads[0]);

    $file = fopen($ad_file, 'r+');
    if (flock ($file, LOCK_EX|LOCK_NB, $would_block) && !$would_block) {
    if ((count ($ads) < $ads_temp[4] + 1 && $ads_temp[0] + $ads_temp[6] < time()) || $ads_temp[0] + $ads_temp[5] < time()) {
    $new_ad = file_get_contents_an ('http://ads.digitalpoint.com/network.php?c=' . $_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_temp[2] . '|' . $ads_param[0]);
    } else {
    $ads_param = array_slice ($ads_temp, 3, 6);
    }
    $ads_temp[1] = (integer)$ads_temp[1] + 1;
    if ($ads_temp[1] > $ads_temp[4]) $ads_temp[1] = 1;
    $ads[0] = time() . '|' . $ads_temp[1] . '|' . gethostbyname('validate.digitalpoint.com') . '|' . implode ('|', $ads_param);
    if ($new_ad) {
    $ads[$ads_temp[1]] = $new_ad;
    if (count ($ads) > $ads_temp[4] + 1) $ads = array_merge ((array)$ads[0], (array)array_slice ($ads, -$ads_temp[4]));
    }
    fwrite ($file, implode ('<ad_break>', $ads));
    ftruncate ($file, ftell($file));
    }
    flock ($file, LOCK_UN);
    fclose ($file);
    }
    $ads_x = 0;
    while (count ($ad_network) < 5) {
    if (count($ad_network) % 2 == 0) {
    $ads_next = (hexdec(substr(md5($_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'] . $_SERVER['QUERY_STRING']), 0, 6)) % (count($ads) - 1 - $ads_x)) + 1;
    $ads_x++;
    } else {
    $ads_next = mt_rand(1,count($ads) - 1);
    }
    $ad_network[] = $ads[$ads_next];
    }
    foreach ($ad_network as $key => $ad) {
    $split = explode ('<id>', $ad);
    $ad_ids[] = $split[1];
    $ad = $split[0];
    $ads_output = $ads_temp[2] == $_SERVER['REMOTE_ADDR'] || $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR'];
    if ($ads_output) {
    $ad_network[$key] = str_replace ('" />', '" class="' . $ads_temp[3] . '" />', $ad);
    } else {
    $ad_network[$key] = str_replace ('" />', '">', $ad);
    }
    }
    $ad_network = implode ('<br />', $ad_network);
    if ($ads_temp[7] && ($ads_output || preg_match('#(' . str_replace ('-', '|', $ads_temp[8]) . ')#si', $_SERVER['HTTP_USER_AGENT'])) && !$_SERVER['HTTPS']) $ad_network .= ' <img src="http://ads.digitalpoint.com/t-' . implode ('-', $ad_ids) . '.gif" width="1" height="1">';
    } else {
    $ad_network = 'You must set the ' . $ad_file . ' file to be writable (check file name as well).';
    }
    if (substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.shtml') {
    ini_set ('zlib.output_compression', 0);
    echo $ad_network;
    }

    ?>


    4. in the index file I have this include:

    <!--#include virtual="ad_network_133.php" -->


    yet no ads are showing.... what is wrong??
     
    shamrock36, Jan 11, 2008 IP
  3. shamrock36

    shamrock36 Active Member

    Messages:
    180
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    ummm anyone?
     
    shamrock36, Jan 12, 2008 IP
  4. AllOutAnime

    AllOutAnime Peon

    Messages:
    186
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    same to me, Idk what´s wrong.
     
    AllOutAnime, Jan 12, 2008 IP