Results 1 to 8 of 8

Thread: Someone asked about a Banner Exchange/Rotator

  1. #1

    Thread Starter
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616

    Someone asked about a Banner Exchange/Rotator

    I found a copy of mine, but it doesnt rotate, but you can easily add that to the script.

    http://www.cpradio.net/thebreakpoint...ange/index.php

    Im not sure who was looking for this or when they were but here is one, and if you want the source I'll zip it and post it.
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I don't get it
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Someone wanted a banner exchange/rotator script for their site and I thought I left the one I wrote in Ohio, but I just found it today on my server, and I will zip up the files and sql info when I get home so the person who wanted it or was attempting to make it can compare what I did to what they are doing.

    If you make an account on that demo you will understand more.
    -Matt
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    But the banner's always the same? I know, it doesn't rotate, but why not just code that in in HTML then if it doesn't change or anything?

    I guess I'm just really confused.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5

    Thread Starter
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Okay, let me write up the about section which will explain it all.
    That site allows you to have others add their banners to the exchange/rotation and will then spit out a line of code for you to place on your site to display the banners.

    -Matt
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    ohhh...spiffy.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7

    Thread Starter
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Here is the files. Import the sql files then run installation by clicking on the install link.

    -Matt
    Attached Files Attached Files
    Last edited by cpradio; Jun 14th, 2002 at 07:30 AM.
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  8. #8
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236
    I believe I was the one looking for one but I created one with a little javascript/php hybrid.

    //start script

    <SCRIPT LANGUAGE="JavaScript">
    // Banner Cycling Program
    // S T A R T
    var urls = new Array();
    var bannerz = new Array();
    var descripts = new Array();
    <?
    $bannerSQL = "SELECT * from banners ORDER BY ID";
    $bannerQuery = mysql_query($bannerSQL);
    $numberBanners = mysql_num_rows($bannerQuery);
    //$numberBanners = $numberBanners - 1;
    for ($z = 0; $z < mysql_num_rows($bannerQuery); $z++)
    {
    $zz = $z + 1;
    $theBanner = mysql_result($bannerQuery, $z, 'bannerlink');
    $theLink = mysql_result($bannerQuery, $z, 'url');
    $theDescript = mysql_result($bannerQuery, $z, 'descript');
    echo("bannerz[$zz] = \"$theBanner\";\n");
    echo("urls[$zz] = \"$theLink\";\n");
    echo("descripts[$zz] = \"$theDescript\";\n");
    }

    ?>

    var randomNumber;

    function pickBanner()
    {
    randomNumber = Math.floor(Math.random()*<?echo($numberBanners);?>);
    oldRandom = randomNumber;
    randomNumber = randomNumber + 1;
    document.mybanner.src=''+bannerz[randomNumber]+'';

    //alert("Old Numb-"+oldRandom+" New Random-"+randomNumber);
    window.status = ""+descripts[randomNumber]+"";
    setTimeout("pickBanner()", 10000);
    }

    function setBanner()
    {
    randomNumber = Math.floor(Math.random()*<?echo($numberBanners);?>);
    randomNumber = randomNumber + 1;
    document.mybanner.src=''+bannerz[randomNumber]+'';
    window.status = ""+descripts[randomNumber]+"";
    setTimeout("pickBanner()", 10000);
    }
    function findURL()
    {
    enpage=window.open("goto.php?thisNum="+randomNumber+"&pid=<?echo($pid);?>","enpage","scrollbars=yes, toolbar=yes,directories=yes,menubar=yes,status=yes,location=yes, resizable=yes left=0, top=0");
    }

    // F I N I S H
    </SCRIPT>

    <body onload='setBanner'>
    <a href='#' onclick='findURL()'><img href='#' src="<? echo($banner); ?>" name='mybanner' width="467" height="60" border="0"></a>

    // end script

    I probably dont need the href='#' in the img tag but if I take it out, I just know somethings going to break.

    The reason for the + 1 in certain places is that I dont have any banners in my table that have an ID of 0... everything starts at 1 which gets tricky with loops and rows.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width