Jump to content

Script Analysis for rotating banner


kcrump

Recommended Posts

I am working on a script that is supposed to rotate that associated .sxf file when it is called by that page. Each page represents a different gallery, therefore a different .sxf banner. Here is what i have but it simply will not work, any advise please?

*// URL to see .http://www.kwcabinets.com/ourwork.php (This is a static php page that shows my example, the rest below are dynamic)


<?
ob_start();
session_start();
include_once "adminsection/conn.php";
if (!isset($_GET["gal"]))
{
header("location:home.php");
exit();
}
else
{
$gal=$_GET["gal"];
}
//$sqlnew="select * from kitchen_main_images where category_name='$gal'";
//$rsnewrest=mysql_query($sqlnew);
//$datatrivia=mysql_fetch_array($rstrivia);
?>
<?php
//Set the page size
$PageSize = 6;
$StartRow = 0;
//Set the page no
if(empty($_GET['PageNo'])){
    if($StartRow == 0){
        $PageNo = $StartRow + 1;
    }
}else{
    $PageNo = $_GET['PageNo'];
    $StartRow = ($PageNo - 1) * $PageSize;
}
//Set the counter start
if($PageNo % $PageSize == 0){
    $CounterStart = $PageNo - ($PageSize - 1);
}else{
    $CounterStart = $PageNo - ($PageNo % $PageSize) + 1;
}
//Counter End
$CounterEnd = $CounterStart + ($PageSize - 1);
$TRecord = mysql_query("SELECT * from kitchen_main_images where category_name='$gal'");
$result = mysql_query("SELECT * FROM kitchen_main_images where category_name='$gal' LIMIT $StartRow,$PageSize");
//Total of record
$RecordCount = mysql_num_rows($TRecord);
//Set Maximum Page
$MaxPage = $RecordCount % $PageSize;
if($RecordCount % $PageSize == 0){
    $MaxPage = $RecordCount / $PageSize;
}else{
    $MaxPage = ceil($RecordCount / $PageSize);
}
?>
<html>
<head>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Kitchen - Kraftworks Cabinet Co.</title>
<link href="includes/global.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
color: #CF4A01;
}
.style7 {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #000000;
}
.style8 {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="760" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>     
<td height="114" valign="bottom" class="headerBG"><table width="574" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="426" height="24"><div align="center">

<?php if($gal==’Kitchen’){ ?>}
// Flash code for Kitchen Banner..
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="574" height="85"><param name="movie" value="flash/kitchenstb.swf"> <PARAM NAME=loop VALUE=false> 
<param name="quality" value="high"> <embed src="flash/kitchenstb.swf" loop=false quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="574" height="85"></embed>
</object>

<? }?>

<?php if ($gal=='media room'){?>}
// Flash code for Kitchen Banner .
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="574" height="85"><param name="movie" value="flash/mroomstb.swf"> <PARAM NAME=loop VALUE=false> 
<param name="quality" value="high"> <embed src="flash/mroomstb.swf" loop=false quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="574" height="85"></embed>
</object>

<? }?>

<?php if($gal==’Bedroom’){ ?>}

            // Flash code for Bedrooms Banner.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="574" height="85"><param name="movie" value="flash/broomtb.swf"> <PARAM NAME=loop VALUE=false> 
<param name="quality" value="high"> <embed src="flash/broomstb.swf" loop=false quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="574" height="85"></embed>
<? }?>

<?php if($gal==’Office’){ ?>}
            // Flash code for Office Banner.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="574" height="85"><param name="movie" value="flash/officetb.swf"> <PARAM NAME=loop VALUE=false> 
<param name="quality" value="high"> <embed src="flash/officetb.swf" loop=false quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="574" height="85"></embed>
<? }?>

<?php if ($gal=='living room'){?>}
            // Flash code for Living Room Banner.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="574" height="85"><param name="movie" value="flash/lroomtb.swf"> <PARAM NAME=loop VALUE=false> 
<param name="quality" value="high"> <embed src="flash/lroomtb.swf" loop=false quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="574" height="85"></embed>
<? }?>

<?php if($gal==’Architectual’){ ?>}
            //Flash code for Architectual Banner.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="574" height="85"><param name="movie" value="flash/archtb.swf"> <PARAM NAME=loop VALUE=false> 
<param name="quality" value="high"> <embed src="flash/archtb.swf" loop=false quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="574" height="85"></embed>
<? }?>

<?php if($gal==’Others’){ ?>
            //Flash code for Others Banner here
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="574" height="85"><param name="movie" value="flash/otherstb.swf"> <PARAM NAME=loop VALUE=false> 
<param name="quality" value="high"> <embed src="flash/otherstb.swf" loop=false quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="574" height="85"></embed>
<? }?>

<br>
</div></td>
</tr>
<tr>
<td height="24">
<script type="text/javascript" src="milonic_src.js"></script>
<script type="text/javascript" src="mmenudom.js"></script>
<!-- The next file contains your menu data, links and menu structure etc -->
<script type="text/javascript" src="menu_data.js"></script></td>
</tr>
</table></td>
</tr>
<tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="90" height="293" valign="top" class="leftBG" >&nbsp;</td>
            <td rowspan="2" valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><div align="right"><span class="style2"><?=$gal?></span></div></td>
              </tr>
              <tr>
                <td align="center"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <? //First For Loop
  $counter=1;
$i = 1;
while ($frnd= mysql_fetch_array($result)) {
    $bil = $i + ($PageNo-1)*$PageSize;
// while($frnd=mysql_fetch_array($rsnewrest))
// {
  if($counter<3)
  {
  ?>
                  <? //2nd FOR LOOP?>
                  <td valign="bottom"><table width="135" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="134" height="65" valign="bottom"><div align="center">
<a href="#" onClick="MM_openBrWindow('gallery_pop.php?main_image=<?=$frnd['image_id']?>&gal=<?=$gal?>','','scrollbars=yes,width=650,height=700')">
<img src="uploadimage/<?=$gal?>/<?=$frnd['image_small']?>" alt="Pic" width="85" border="0"></a></div></td>
                      </tr>
                      <tr>
                        <td height="16"><div align="center"> <a href="#" onClick="MM_openBrWindow('gallery_pop.php?main_image=<?=$frnd['image_id']?>&gal=<?=$gal?>','','scrollbars=yes,width=650,height=700')"><span class="style7 style42"><strong>
                          <?=$frnd['image_title']?>
                        </strong></span></a></div></td>
                      </tr>
                      <tr>
                        <td height="16"><div align="center"><span class="style42 style7"><?=$frnd['image_description']?></span></div></td>
                      </tr>
                  </table></td>
                  <?
  }
  else
  {
  $counter=0;
  ?>
                  <? //2nd FOR LOOP?>
                  <td valign="bottom"><table width="135" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="65" valign="bottom"><div align="center"><a href="#" onClick="MM_openBrWindow('gallery_pop.php?main_image=<?=$frnd['image_id']?>&gal=<?=$gal?>','','scrollbars=yes,width=650,height=700')"><img src="uploadimage/<?=$gal?>/<?=$frnd['image_small']?>" width="85" alt="Pic" border="0"></a></div></td>
                      </tr>
                      <tr>
                        <td height="16"><div align="center"><a href="#" onClick="MM_openBrWindow('gallery_pop.php?main_image=<?=$frnd['image_id']?>&gal=<?=$gal?>','','scrollbars=yes,width=650,height=700')"><span class="style7 style42"><strong>
                          <?=$frnd['image_title']?>
                        </strong></span></a></div></td>
                      </tr>
                      <tr>
                        <td height="16"><div align="center"><span class="style42 style7"><?=$frnd['image_description']?></span></div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <?
}
  $counter++;
  $i++;
  }
  ?>
                </tr>
            </table> </td>
              </tr>
  <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><div align="center" class="style8">
      <?php
        //Print First & Previous Link is necessary
        if($CounterStart != 1){
            $PrevStart = $CounterStart - 1;
            print "<a href=gallery.php?gal=$gal&PageNo=1>First </a>: ";
            print "<a href=gallery.php?gal=$gal&PageNo=$PrevStart>Previous </a>";
        }
        print " [ ";
        $c = 0;
        //Print Page No
        for($c=$CounterStart;$c<=$CounterEnd;$c++){
            if($c < $MaxPage){
                if($c == $PageNo){
                    if($c % $PageSize == 0){
                        print "&nbsp;$c ";
                    }else{
                        print "&nbsp;$c , &nbsp;";
                    }
                }elseif($c % $PageSize == 0){
                    echo "<a href=gallery.php?gal=$gal&PageNo=$c>$c</a> ";
                }else{
                    echo "<a href=gallery.php?gal=$gal&PageNo=$c>$c</a> ,";
                }//END IF
            }else{
                if($PageNo == $MaxPage){
                    print "&nbsp;$c ";
                    break;
                }else{
                    echo "<a href=gallery.php?gal=$gal&PageNo=$c>$c</a> ";
                    break;
                }//END IF
            }//END IF
      }//NEXT
      echo "] ";
      if($CounterEnd < $MaxPage){
          $NextPage = $CounterEnd + 1;
          echo "<a href=gallery.php?gal=$gal&PageNo=$NextPage>Next</a>";
      }
      //Print Last link if necessary
      if($CounterEnd < $MaxPage){
      $LastRec = $RecordCount % $PageSize;
        if($LastRec == 0){
            $LastStartRecord = $RecordCount - $PageSize;
        }
        else{
            $LastStartRecord = $RecordCount - $LastRec;
        }
        print " : ";
        echo "<a href=gallery.php?gal=$gal&PageNo=$MaxPage>Last</a>";
        }
      ?>
                </div></td>
              </tr>
            </table></td>
            <td width="90" valign="top" class="rightBG">&nbsp;</td>
          </tr>
          <tr>
            <td  valign="top" background="images/rightpic.jpg">&nbsp;</td>
            <td width="90" valign="top" background="images/leftpic.jpg">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
  <tr>
            <td height="112"  colspan="3" class="headerBG">&nbsp;</td>
            </tr>
      <tr>
        <td bgcolor="#999999" height="1"></td>
      </tr>
      <tr>
        <td><div align="center"><? include("footer.php")?></div></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
Link to comment
https://forums.phpfreaks.com/topic/36084-script-analysis-for-rotating-banner/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.