I tried to setup a COOP network on my site handlemistakes.com. I followed all instructions but the ads don't show up
I followed the setup instructions at the setup page. I tested the textfile with both chmod 666 and chmod 777, both attempts was unsuccessfull. Contents: ad_network_229.txt (none) ad_network_229.php <?php // Last update: October 6, 2005 5:49 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_234.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 || true) { $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; } ?> PHP: index.php(the frontpage) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>How to handle mistakes</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="description" content="A forum-tutorial for people that wants to learn how to handle mistakes. This will help you to solve and prevent mistakes."> <meta name="keywords" content="mistakes, mistake forum, help with mistakes, solve mistakes, prevent mistakes, free solutions, mistake problems, serious problems, the human factor, memory problems"> <link href="forum/skin/style.css" rel="stylesheet" type="text/css" > </head> <body> <div class="page_size"> <img src="forum/skin/logo.gif" alt="handle mistakes"> <div class="lankar"> Home | <a href="http://forum.handlemistakes.com">Forum</a> | <a href='http://www.handlemistakes.com/Strategies_for_solving_mistakes.htm'>Strategies</a> | <a href='http://www.handlemistakes.com/Trouble_scenarios_and_mistake_situations.htm'>Scenarios</a> | <a href="http://www.handlemistakes.com/quiz/quiz.php">Quiz</a> | <a href="http://forum.handlemistakes.com/article28.htm">Links</a> | <a href="http://www.cafepress.com/handlemistakes" target="_blank">Shop</a> </div> <br> <br> <h1>How to handle mistake-problems</h1> <img src="math.gif" align="right" hspace="20" vspace="20" alt="simple math mistake"> <p>Do you have problems in handling your own mistakes? Do you get embarrassed when you do wrong and hate yourself for doing it? In that case, you just came to the right place. You are desperately in need for solutions. Don't let your self-esteem and your honor be crushed one more time, you deserve a better reality! </p> <p>Mistakes are a natural gift that was given to you by yourself. It is also called; "The human factor" and has led our race (Homo sapiens) to develop religions, Coca-Cola, the rubber, Penicillin and many other creative inventions. When you make mistakes while others succeed, it creates jealousy and jealousy combined is the feeling that makes us creative according to most scientists. Jealousy creates competition and competition creates creativity. Therefore, mistakes can in many ways be a very good advantage. </p> <p>You might prefer a future without any mistakes. That is however impossible, with some exceptions. If you learn to remember your home-keys you will still make other mistakes such as forgetting to return books to the library, forgetting to eat breakfast and so on. This behaviour can be both conscious and unconscious. That's why you should prepare yourself for good excuses and solutions when you failed to prevent a mistake, to neutralize the circumstances. </p> <p>This site is intended for those who have problems with mistakes and want fast, easy and free solutions.</p> <br><table cellpadding="10px"><tr><td width="50%" VALIGN="top"> <div class="topictable"><div class="statstitle">Strategies</div><div class="topiccell">Check our Strategy page on the top for general excuses. You will find articles on methods that you can imply in the real world. But no article can help you to solve all mistakes at once. You have to mix them depending on the situation. If you have a new general strategy then please tell us about it in our <a href="http://forum.handlemistakes.com/forum1.htm">Strategy forum</a>.</div> </div> <br> <div class="topictable"><div class="statstitle">Feedback</div><div class="topiccell">If you have any thoughts about this site, then please share them with us in the <a href="http://forum.handlemistakes.com/article20.htm">Feedback thread</a></div></div> </td><td VALIGN="top"> <div class="topictable"><div class="statstitle">Scenarios</div><div class="topiccell">Our Scenario page includes more specific solution articles. Those articles are meant to be to people that want to solve specific cases. It's much easier to find a direct answer there than in the Strategy box. If you would like to take up a new specific issue that hasn't yet been written about then write a request in our <a href="http://forum.handlemistakes.com/forum2.htm">Scenario forum</a>.</diV> </div> <br> <div class="topictable"><div class="statstitle">Newsletter</div><div class="topiccell">If you like to receive information about future updates then subscribe to our newsletter <form method="get" action="newsletter/sub.php"> E-mail: <input type="text" name="email" size="30"> <input type="submit" value="Add"> </form></div></div> </td></tr></table> <br><br> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="latehorn@gmail.com"> <input type="hidden" name="item_name" value="http://www.handlemistakes.com"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="tax" value="0"> <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> </form> <br><br> <br> <?php DEFINE ('SEO-BOARD', true); include('forum/lastposts_addon.php'); ?> <br> <hr> <br><script type="text/javascript"><!-- google_ad_client = "pub-5705229933088563"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text"; google_ad_channel =""; google_color_border = "FFFFFF"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <br> <br> ©Copyright 2006 <a href="http://www.handlemistakes.com">Handle mistakes</a> All Rights Reserved. <br> <?php ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../'); include ('ad_network_234.php'); echo $ad_network; ?> </div> </body> </html> PHP: .htaccess(mayby because of the url rewrites) AddType application/x-httpd-php .php .htm .html RewriteEngine On RewriteRule ^forum/forum([0-9]+)\.htm$ ./index.php?a=vforum&f=$1 RewriteRule ^forum/forum([0-9]+)-([0-9]+)\.htm$ ./index.php?a=vforum&f=$1&p=$2 RewriteRule ^forum/article([0-9]+)\.htm$ ./index.php?a=vtopic&t=$1 RewriteRule ^forum/article([0-9]+)-([0-9]+)\.htm$ ./index.php?a=vtopic&t=$1&p=$2 ErrorDocument 400 /error400.html ErrorDocument 401 /error401.html ErrorDocument 402 /error402.html ErrorDocument 403 /error403.html ErrorDocument 404 /error404.html ErrorDocument 500 /error500.html Code (markup): Hope that this information can make it clearer.
It looks like your index.php is including ad_network_234.php, while your ad_network php file is actually revision ad_network_229.php. # <?php # ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../'); # include ('ad_network_234.php'); # echo $ad_network; # ?> Code (markup):
Well thats pretty cool, thanks Will! This problem occured because I created the filesa few days before. Hope that Shawn will be able to fix that bug. You must spread some Reputation around before giving it to Will.Spencer again. damn