eaglelegend Posted May 27, 2008 Share Posted May 27, 2008 Hey, I have been trying to code for a little while code that can show both my sites advertisements, and advertisements provided by "project wonderful, its a great idea and all, but I cant seem to find a way to make it work now :/... Parse error: syntax error, unexpected T_STRING in /misc/39/000/171/334/2/user/web/eaglelegend.com/ad.php on line 31 The Ad.php Code <?php include '/ads/mysql.php'; $ads = $_GET['ads']; if($ads == 'EL') { print "ads = array( if ($ad == false) { // No ads: die('// No ad\'s')"; } if($ads == 'PW') { print "<!-- Begin Project Wonderful ad code: --> <!-- IMPORTANT: All lines, including these comments, must be included. --> <!-- Removal or unauthorized alteration may result in your ads being automatically suspended! --> <!-- Ad box ID: 19350 --> <script language='JavaScript' type='text/javascript'> // <![CDATA[ //On the next two lines, you can set custom colours for your //ad box, which will override anything you've set on //Project Wonderful. This is useful when you have the //same ad box appearing on pages with different colour //schemes. Use only hexadecimal colour codes here. If you //don't understand what this means, don't worry! You can leave //the code unaltered and your ads will still display properly. foregroundColor=''; backgroundColor=''; r = new String (Math.random()*1000); r = r.substr(0, 5); s = new String (String.fromCharCode(60)); s += "script language='JavaScript' type='text/javascript'"; s += "src = http://www.projectwonderful.com/gen.php"; s += "?id=19350&type=3"; s += "&r=" + r; if (document.referrer){ s += "&referer=" + escape(document.referrer); } s += "><\/scr"; s += "ipt>"; document.write(s); // ]]> </script> <noscript><map name="admap19350" id="admap19350"><area href="http://www.projectwonderful.com/out_nojs.php?r=0&c=0&id=19350&type=3" shape="rect" coords="0,0,160,600" title="" alt="" target="_blank" /></map> <table cellpadding="0" border="0" cellspacing="0" width="160" bgcolor="#ffffff" class="text_box"><tr><td><img src="http://www.projectwonderful.com/nojs.php?id=19350&type=3" width="160" height="600" usemap="#admap19350" border="0" alt="" /></td></tr><tr><td bgcolor="#ffffff" colspan="1"><center><a style="font-size:10px;color:#0000ff;text-decoration:none;line-height:1.2;font-weight:bold;font-family:Tahoma, verdana,arial,helvetica,sans-serif;text-transform: none;letter-spacing:normal;text-shadow:none;white-space:normal;word-spacing:normal;" href="http://www.projectwonderful.com/advertisehere.php?id=19350&type=3" target="_blank">Project Wonderful - Your ad here, right now, for as low as $0.00</a></center></td></tr><tr><td colspan=1 valign="top" width=160 bgcolor="#000000" style="height:3px;font-size:1px;padding:0px;max-height:3px;"></td></tr></table> </noscript> <!-- End Project Wonderful ad code. -->"; } $link = $ad['link']; $image = $ad['image']; // Display ad: header ("Content-Type: text/javascript"); echo "document.write ('<a href=\"$link\"><img src=\"$image\" alt=\"Ad Banner\" style=\"border:0;\" width=\"160\" height=\"600\" /></a>');"; // Update viewed count $db->query ("UPDATE ad SET viewed = viewed + 1 WHERE adid = " . $ad['adid']);"; } // Insert new view into traffic table $datetime = time(); $ipaddress = ss($_SERVER['REMOTE_ADDR']); // ### Log file $logfile = '/ads/log.txt'; // ### Advertisements: $ads = array( // Array (link to website, image url) array('http://www.eaglelegend.com/ad?=EL'), array('http://www.eaglelegend.com/ad?=PW'), ); // Get a random ad $adkey = array_rand($ads, 1); // Get ad $ad = $ads[$adkey]; $url = $ad['0']; // Display ad: if($ads == '$url') header ("Content-Type: text/javascript"); echo "document.write ('<iframe src=\"$url\" width=\"160\" height=\"600\" marginwidth=\"0\" marginheight=\"0\" margin=\"0\" frameborder=\"0\">');"; ?> If you read the notice on "project wonderful"'s code, I cannot alter it, so... the problem is, the area it is saying the problem is, is inside that code :/ Help is much appreciated, thank you! Link to comment https://forums.phpfreaks.com/topic/107417-multi-advetisements/ Share on other sites More sharing options...
eaglelegend Posted May 27, 2008 Author Share Posted May 27, 2008 ??? Link to comment https://forums.phpfreaks.com/topic/107417-multi-advetisements/#findComment-550673 Share on other sites More sharing options...
BlueSkyIS Posted May 27, 2008 Share Posted May 27, 2008 what is this? print "ads = array( Link to comment https://forums.phpfreaks.com/topic/107417-multi-advetisements/#findComment-550705 Share on other sites More sharing options...
eaglelegend Posted May 27, 2008 Author Share Posted May 27, 2008 its to randomly choose the ads, however if you had done my code you MAY of understood :/ anyone know? Link to comment https://forums.phpfreaks.com/topic/107417-multi-advetisements/#findComment-550899 Share on other sites More sharing options...
BlueSkyIS Posted May 27, 2008 Share Posted May 27, 2008 i'm just saying, this is invalid PHP: if($ads == 'EL') { print "ads = array( if ($ad == false) { // No ads: die('// No ad\'s')"; } Link to comment https://forums.phpfreaks.com/topic/107417-multi-advetisements/#findComment-550902 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.