banner rotation

Discussion in 'PHP' started by micromark, Aug 24, 2007.

  1. #1
    Hi people,

    Any1 have a good banner rotation script?

    Many thanks.
     
    micromark, Aug 24, 2007 IP
  2. Overclock099

    Overclock099 Notable Member

    Messages:
    3,648
    Likes Received:
    122
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Overclock099, Aug 24, 2007 IP
  3. micromark

    micromark Peon

    Messages:
    466
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ok thanks i will try that.
     
    micromark, Aug 24, 2007 IP
  4. Brewster

    Brewster Active Member

    Messages:
    489
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Brewster, Aug 24, 2007 IP
  5. manager

    manager Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    iu.php
    <?php
    
    $iunum=4;//quantity banners on page
    $iutw="100%";//width of the table in which are banners displayed
    $iubw=150;//width
    $iubh=70;//height
    $iu="iu.dx";//datebase location
    $iupics="http://www.site.com/iudata/";//address of a folder with images
    
    $fp = fopen($iu, "r");
    $iu_in = fread($fp, filesize($iu));
    fclose($fp);
    $iuline = explode("\n", $iu_in);
    
    $is=sizeof($iuline);
    $i=$is-1-$iunum;
    srand((double)microtime()*1000000);
    $spoint=rand(0,$i);
    $rpoint=rand(1,$iunum);
    
    echo "<table width=$iutw border=0><tr>";
    for ($e=0;$e<$iunum;$e++) {
    	if (($spoint+$rpoint+$e)>=($spoint+$iunum)) {$rcorr=$iunum;} else {$rcorr=0;}
    	$iudata = explode("|", $iuline[$spoint+$rpoint+$e-$rcorr]);
    	echo "<td align=center><a href=$iudata[2] target=_top><img src=$iupics$iudata[0] width=$iubw height=$iubh alt=\"$iudata[1]\" border=0></a><br></td>";
    }
    echo "</tr></table>";
    
    ?>
    PHP:
    iu.dx
    1.gif|description|http://www.site.com
    2.gif|description|http://www.site.com
    3.gif|description|http://www.site.com
    PHP:
    Simple code. Have fun!
     
    manager, Aug 24, 2007 IP