Jump to content

Cannot view HTML in Text Editor


Recommended Posts

Let me apologize in advance for what may seem like a very stupid question for most of you. I am very new to php. I am simply trying to view/html in a .PHP file using Alleycode text editor. When I download the file from the server to my local PC, open the file in Alleycode, I cannot see the HTML. All that I see is the PHP code. Can someone provide me with instruction on how I might view then edit the HTML?

 

Here is the code from Alleycode:

<?php

/*******************************************************************\

* CashbackEngine v1.1

* http://www.CashbackEngine.net

*

* Copyright © 2010 CashbackEngine Software. All rights reserved.

* ------------ CashbackEngine IS NOT FREE SOFTWARE --------------

\*******************************************************************/

 

  session_start();

  require_once("inc/config.inc.php");

  require_once("inc/pagination.inc.php");

 

  $results_per_page = RESULTS_PER_PAGE;

  $cc = 0;

 

 

  function getCategory($category_id, $description = 0)

  {

      if (isset($category_id) && is_numeric($category_id) && $category_id != 0)

      {

        $query = "SELECT name, description FROM cashbackengine_categories WHERE category_id='".(int)$category_id."'";

        $result = smart_mysql_query($query);

        if (mysql_num_rows($result) > 0)

        {

            $row = mysql_fetch_array($result);

            if ($description == 1) return $row['description']; else return $row['name'];

        }else

        {

            return "Category not found";

        }

      }

      else

      {

        if ($description != 1) return "Retailers";

      }

  }

 

  ////////////////// filter  //////////////////////

      if (isset($_GET['column']) && $_GET['column'] != "")

      {

        switch ($_GET['column'])

        {

            case "title": $rrorder = "title"; break;

            case "added": $rrorder = "added"; break;

            case "visits": $rrorder = "visits"; break;

            case "cashback": $rrorder = "cashback"; break;

            default: $rrorder = "title"; break;

        }

      }

      else

      {

        $rrorder = "title";

      }

 

      if (isset($_GET['order']) && $_GET['order'] != "")

      {

        switch ($_GET['order'])

        {

            case "asc": $rorder = "asc"; break;

            case "desc": $rorder = "desc"; break;

            default: $rorder = "asc"; break;

        }

      }

      else

      {

        $rorder = "asc";

      }

  //////////////////////////////////////////////////

 

  if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; }

 

  $from = ($page-1)*$results_per_page;

  $where = "";

 

  if (isset($_GET['cat']) && is_numeric($_GET['cat']) && $_GET['cat'] > 0)

  {

      $cat_id = (int)$_GET['cat'];

 

      unset($retailers_per_category);

      $retailers_per_category = array();

      $retailers_per_category[] = "111111111111111111111";

 

      $sql_retailers_per_category = smart_mysql_query("SELECT retailer_id FROM cashbackengine_retailer_to_category WHERE category_id='$cat_id'");

      while ($row_retailers_per_category = mysql_fetch_array($sql_retailers_per_category))

      {

        $retailers_per_category[] = $row_retailers_per_category['retailer_id'];

      }

 

      $where .= "retailer_id IN (".implode(",",$retailers_per_category).") AND";

  }

 

  if (isset($_GET['letter']) && in_array($_GET['letter'], $alphabet))

  {

      $ltr = mysql_real_escape_string(getGetParameter('letter'));

 

      if ($ltr == "0-9")

      {

        $where .= " title REGEXP '^[0-9]' AND";

      }else{

        $ltr = substr($ltr, 0, 1);

        $where .= " UPPER(title) LIKE '$ltr%' AND";

      }

  }

 

  $where .= " status='active'";

 

  if ($rrorder == "cashback")

      $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY ABS(cashback) $rorder LIMIT $from, $results_per_page";

  else

      $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY $rrorder $rorder LIMIT $from, $results_per_page";

 

  $total_result = smart_mysql_query("SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY title ASC");

  $total = mysql_num_rows($total_result);

 

  $result = smart_mysql_query($query);

  $total_on_page = mysql_num_rows($result);

 

 

  ///////////////  Page config  ///////////////

  $PAGE_TITLE = getCategory($_GET['cat']);

 

  require_once ("inc/header.inc.php");

 

?>

 

 

  <h1><?php echo getCategory($_GET['cat']); ?></h1>

 

 

<?php

 

  if ($total > 0) {

 

?>

 

  <p class="category_description"><?php echo getCategory($_GET['cat'], 1); ?></p>

 

  <div id="alphabet">

      <ul>

        <li><a href="/retailers.php">All</a></li>

        <?php

 

            $numLetters = count($alphabet);

            $i = 0;

 

            foreach ($alphabet as $letter)

            {

              $i++;

              if ($i == $numLetters) $lilast = ' class="last"'; else $lilast = '';

 

              if (isset($cat_id) && is_numeric($cat_id))

                  echo "<li".$lilast."><a href=\"/retailers.php?cat=$cat_id&letter=$letter\">$letter</a></li>";

              else

                  echo "<li".$lilast."><a href=\"/retailers.php?letter=$letter\">$letter</a></li>";

            }

        ?>

      </ul>

  </div>

 

  <div class="browse_top">

      <div class="sortby">

        <form action="retailers.php" id="form1" name="form1" method="get">

            <span>Sort by:</span>

            <select name="column" id="column" onChange="document.form1.submit()">

              <option value="title" <?php if ($_GET['column'] == "title") echo "selected"; ?>>Name</option>

              <option value="visits" <?php if ($_GET['column'] == "visits") echo "selected"; ?>>Popular</option>

              <option value="added" <?php if ($_GET['column'] == "added") echo "selected"; ?>>Newest</option>

              <option value="cashback" <?php if ($_GET['column'] == "cashback") echo "selected"; ?>>Cashback</option>

            </select>

            <select name="order" id="order" onChange="document.form1.submit()">

              <option value="desc"<?php if ($_GET['order'] == "desc") echo "selected"; ?>>Descending</option>

              <option value="asc" <?php if ($_GET['order'] == "asc") echo "selected"; ?>>Ascending</option>

            </select>

            <?php if ($cat_id) { ?><input type="hidden" name="cat" value="<?php echo $cat_id; ?>" /><?php } ?>

            <?php if ($ltr) { ?><input type="hidden" name="letter" value="<?php echo $ltr; ?>" /><?php } ?>

            <input type="hidden" name="page" value="<?php echo $page; ?>" />

        </form>

      </div>

      <div class="results">

            Showing <?php echo ($from + 1); ?> - <?php echo min($from + $total_on_page, $total); ?> of <?php echo $total; ?>

      </div>

  </div>

 

        <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5">

        <?php

              while ($row = mysql_fetch_array($result))

              {

                  $cc++;

        ?>

            <tr class="<?php if (($cc%2) == 0) echo "even"; else echo "odd"; ?>">

              <td width="125" align="center" valign="middle">

                  <?php if ($row['featured'] == 1) { ?><span class="featured" alt="Featured Retailer" title="Featured Retailer"></span><?php } ?>

                  <div id="shadow"><a href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><img src="<?php if (!stristr($row['image'], 'http')) echo "/img/"; echo $row['image']; ?>" width="<?php echo IMAGE_WIDTH; ?>" height="<?php echo IMAGE_HEIGHT; ?>" alt="<?php echo $row['title']; ?>" title="<?php echo $row['title']; ?>" border="0" class="imgs" /></a></div>

              </td>

              <td align="left" valign="top">

 

                  <table width="100%" border="0" cellspacing="0" cellpadding="3">

                    <tr>

                        <td width="80%" align="left" valign="top">

                          <a class="retailer_title" href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><?php echo $row['title']; ?></a>

                        </td>

                        <td nowrap="nowrap" width="20%" align="right" valign="top">

                          <span class="cashback"><?php echo DisplayCashback($row['cashback']); ?>X Points</span>

                        </td>

                    </tr>

                    <tr>

                        <td colspan="2" valign="middle" align="left"><p class="retailer_description"><?php echo $row['description']; ?> </p></td>

                    </tr>

                    <tr>

                        <td valign="middle" align="left">

                        <?php if ($row['conditions'] != "") { ?>

                          <div class="cashbackengine_tooltip">

                              <a class="conditions" href="#">Conditions</a> <span class="tooltip"><?php echo $row['conditions']; ?></span>

                          </div>

                        <?php } ?>

                          <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=<?php echo $row['retailer_id']; ?>'">Add to Favorites</a>

                        </td>

                        <td valign="middle" align="right">

                          <a class="go2store" href="/go2store.php?id=<?php echo $row['retailer_id']; ?>" target="_blank">Go to Store</a>

                        </td>

                    </tr>

                  </table>

 

              </td>

            </tr>

 

        <?php } ?>

            <tr>

              <td valign="middle" align="center" colspan="2">

              <?php

                    $params = "";

                    if (isset($cat_id) && $cat_id > 0) { $params = "cat=$cat_id&"; }

                    if (isset($ltr) && $ltr != "") { $params = "letter=$ltr&"; }

 

                    echo ShowPagination("retailers",$results_per_page,"retailers.php?".$params."column=$rrorder&order=$rorder&","WHERE ".$where);

              ?>

              </td>

              </tr>

              </table>

 

  <?php }else{ ?>

      <p align="center">There are no stores to list in this category!<br/><br/><a class="goback" href="#" onclick="history.go(-1);return false;">Go Back</a></p>

  <?php } ?>

 

<?php require_once ("inc/footer.inc.php"); ?>

Here is the code from the browser (View Source)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

      <title>Retailers | Bonus.me</title>

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

      <link rel="stylesheet" type="text/css" href="/css/style.css" />

      <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>

      <script type="text/javascript" src="/js/jquery.autocomplete.js"></script>

      <script type="text/javascript" src="/js/cashbackengine.js"></script>

      <link rel="shortcut icon" href="/favicon.ico" />

      <link rel="icon" type="image/ico" href="/favicon.ico" />

</head>

<body>

 

<div id="container">

<div id="header">

  <div id="logo"><a href="http://www.bonus.me/"><img src="/images/LogoSiteFinal.png" alt="Bonus.me" title="Bonus.me" border="0" /></a></div>

  <div id="links">

                <a href="/login.php">Log In</a> | <a href="/register.php">Sign Up</a>

          </div>

  <div id="searchbox">

      <form action="search.php" method="get" id="searchfrm" name="searchfrm">

        <input type="text" id="searchtext" name="searchtext" class="search_inputt" value="Search for stores..." onclick="if (this.defaultValue==this.value) this.value=''" onkeydown="this.style.color='#000000'" onblur="if (this.value=='') this.value=this.defaultValue" />

        <input type="hidden" name="action" value="search" />

        <input type="submit" class="search_button" value="" />

      </form>

  </div>

</div>

 

  <div id="menu">

      <a href="/">Home</a>

      <a href="/retailers.php">Online Shopping</a>

      <a href="/instore.php">In Store Shopping</a>

      <a href="/myaccount.php">My Account</a>

      <a href="/withdraw.php">My Rewards</a>

      <a href="/invite.php">Get More</a>

      <a href="/benny.php">Benny</a>

  </div>

 

<div id="column_left">

 

 

      <div class="box">

        <div class="top">Member Login</div>

        <div class="middle">

              <form action="login.php" method="post">

                  Email Address:<br/>

                  <input type="text" class="inputt" name="username" value="" size="22" />

                  Password:<br/>

                  <input type="password" class="inputt" name="password" value="" size="22" />

                    <input type="hidden" name="action" value="login" />

                  <input type="submit" class="butt" style="margin-top: 2px;" name="login" id="login" value="Login" />

                  <br/><br/><a href="/forgot.php">Forgot your password?</a>

                  <br/><br/>Not a Member? <a href="/register.php">Sign Up!</a>

              </form>

        </div>

        <div class="bottom"> </div>

      </div>

 

   

      <div class="box">

        <div class="top">Shop by Category</div>

        <div class="middle">

            <ul id="categories">

                  <li><a href="/retailers.php">All Stores</a></li>

                  <ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=41">Art, Music & Photo</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=40">Automotive</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=1">Books & Magazines</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=38">Department & Discount</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=6">Education</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=7">Electronics & Computers</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=2">Fashion & Apparel</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=36">Children&#039;s Fashion</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=35">Men&#039;s Fashions</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=42">Shoes</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=34">Women&#039;s Fashion</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=9">Flowers</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=10">Food & Drink</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=12">Gifts & Party</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=13">Health & Beauty</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=14">Home & Garden</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=16">Jewelry</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=17">Mobile Phones & Accesories</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=19">Office</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=22">Pets</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=39">Recreation & Leisure</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=15">Software</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=23">Sports & Fitness</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=24">Toys & Games</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=37">Travel</a></li></ul>            </ul>

        </div>

        <div class="bottom"> </div>

      </div>

 

</div>

 

<div id="column_center">

 

 

  <h1>Retailers</h1>

 

 

 

  <p class="category_description"></p>

 

  <div id="alphabet">

      <ul>

        <li><a href="/retailers.php">All</a></li>

        <li><a href="/retailers.php?letter=0-9">0-9</a></li><li><a href="/retailers.php?letter=A">A</a></li><li><a href="/retailers.php?letter=B">B</a></li><li><a href="/retailers.php?letter=C">C</a></li><li><a href="/retailers.php?letter=D">D</a></li><li><a href="/retailers.php?letter=E">E</a></li><li><a href="/retailers.php?letter=F">F</a></li><li><a href="/retailers.php?letter=G">G</a></li><li><a href="/retailers.php?letter=H">H</a></li><li><a href="/retailers.php?letter=I">I</a></li><li><a href="/retailers.php?letter=J">J</a></li><li><a href="/retailers.php?letter=K">K</a></li><li><a href="/retailers.php?letter=L">L</a></li><li><a href="/retailers.php?letter=M">M</a></li><li><a href="/retailers.php?letter=N">N</a></li><li><a href="/retailers.php?letter=O">O</a></li><li><a href="/retailers.php?letter=P">P</a></li><li><a href="/retailers.php?letter=Q">Q</a></li><li><a href="/retailers.php?letter=R">R</a></li><li><a href="/retailers.php?letter=S">S</a></li><li><a href="/retailers.php?letter=T">T</a></li><li><a href="/retailers.php?letter=U">U</a></li><li><a href="/retailers.php?letter=V">V</a></li><li><a href="/retailers.php?letter=W">W</a></li><li><a href="/retailers.php?letter=X">X</a></li><li><a href="/retailers.php?letter=Y">Y</a></li><li class="last"><a href="/retailers.php?letter=Z">Z</a></li>      </ul>

  </div>

 

  <div class="browse_top">

      <div class="sortby">

        <form action="retailers.php" id="form1" name="form1" method="get">

            <span>Sort by:</span>

            <select name="column" id="column" onChange="document.form1.submit()">

              <option value="title" >Name</option>

              <option value="visits" >Popular</option>

              <option value="added" >Newest</option>

              <option value="cashback" >Cashback</option>

            </select>

            <select name="order" id="order" onChange="document.form1.submit()">

              <option value="desc">Descending</option>

              <option value="asc" >Ascending</option>

            </select>

                                    <input type="hidden" name="page" value="1" />

        </form>

      </div>

      <div class="results">

            Showing 1 - 2 of 2      </div>

  </div>

 

        <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5">

                    <tr class="odd">

              <td width="125" align="center" valign="middle">

                                    <div id="shadow"><a href="/view_retailer.php?rid=13"><img src="<a href="http://click.linksynergy.com/fs-bin/click?id=8jghEyj/xMI&offerid=226353.10000004&subid=0&type=4"><IMG border="0"  alt="Fanzz General Banner 120x90" src="http://ad.linksynergy.com/fs-bin/show?id=8jghEyj/xMI&bids=226353.10000004&subid=0&type=4&gri" width="120" height="60" alt="Fanzz.com" title="Fanzz.com" border="0" class="imgs" /></a></div>

              </td>

              <td align="left" valign="top">

 

                  <table width="100%" border="0" cellspacing="0" cellpadding="3">

                    <tr>

                        <td width="80%" align="left" valign="top">

                          <a class="retailer_title" href="/view_retailer.php?rid=13">Fanzz.com</a>

                        </td>

                        <td nowrap="nowrap" width="20%" align="right" valign="top">

                          <span class="cashback">7X Points</span>

                        </td>

                    </tr>

                    <tr>

                        <td colspan="2" valign="middle" align="left"><p class="retailer_description">Fanzz.com sells licensed sports apparel and gifts from the NFL, NBA, MLB, NCAA, NHL, MLS, NASCAR and WNBA. We have dozens of top brands on our site including Nike, Adidas, Reebok, New Era, Antigua, Baseline, Fathead, Fanmats, Majestic, Mitchell and Ness, Under Armour, Wilson, Wincraft and many more. </p></td>

                    </tr>

                    <tr>

                        <td valign="middle" align="left">

                                                  <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=13'">Add to Favorites</a>

                        </td>

                        <td valign="middle" align="right">

                          <a class="go2store" href="/go2store.php?id=13" target="_blank">Go to Store</a>

                        </td>

                    </tr>

                  </table>

 

              </td>

            </tr>

 

                    <tr class="even">

              <td width="125" align="center" valign="middle">

                                    <div id="shadow"><a href="/view_retailer.php?rid=14"><img src="http://www.ftjcfx.com/image-5471697-10807939" width="120" height="60" alt="Pets Warehouse" title="Pets Warehouse" border="0" class="imgs" /></a></div>

              </td>

              <td align="left" valign="top">

 

                  <table width="100%" border="0" cellspacing="0" cellpadding="3">

                    <tr>

                        <td width="80%" align="left" valign="top">

                          <a class="retailer_title" href="/view_retailer.php?rid=14">Pets Warehouse</a>

                        </td>

                        <td nowrap="nowrap" width="20%" align="right" valign="top">

                          <span class="cashback">9X Points</span>

                        </td>

                    </tr>

                    <tr>

                        <td colspan="2" valign="middle" align="left"><p class="retailer_description">Founded in 1974 Pets Warehouse® provides the broadest selection of pet supplies available anywhere online, add value to your site and benefit your customers with low prices. </p></td>

                    </tr>

                    <tr>

                        <td valign="middle" align="left">

                                                  <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=14'">Add to Favorites</a>

                        </td>

                        <td valign="middle" align="right">

                          <a class="go2store" href="/go2store.php?id=14" target="_blank">Go to Store</a>

                        </td>

                    </tr>

                  </table>

 

              </td>

            </tr>

 

                    <tr>

              <td valign="middle" align="center" colspan="2">

                            </td>

              </tr>

              </table>

 

 

 

</div>

 

<div id="column_right">

 

  <div class="center">

 

      <p align="center">

        <a href="/invite.php"><img src="/images/ReferAFriend.gif" border="0"></a></br>

        <a href="/invite.php">Refer A Friend<br/>And Get More!</a>

      </p>

 

  </div>

 

</div>

 

<div id="footer">

 

  <a href="/terms.php">Terms & Conditions</a> · <a href="/contact.php">Contact Us</a> · <a href="/help.php">FAQs</a>

  <p>© December, 2011.  Bonus.Me. All rights reserved.</p>

 

</div>

 

</div>

 

</body>

</html>

 

  $results_per_page = RESULTS_PER_PAGE;

  $cc = 0;

 

 

  function getCategory($category_id, $description = 0)

  {

      if (isset($category_id) && is_numeric($category_id) && $category_id != 0)

      {

        $query = "SELECT name, description FROM cashbackengine_categories WHERE category_id='".(int)$category_id."'";

        $result = smart_mysql_query($query);

        if (mysql_num_rows($result) > 0)

        {

            $row = mysql_fetch_array($result);

            if ($description == 1) return $row['description']; else return $row['name'];

        }else

        {

            return "Category not found";

        }

      }

      else

      {

        if ($description != 1) return "Retailers";

      }

  }

 

  ////////////////// filter  //////////////////////

      if (isset($_GET['column']) && $_GET['column'] != "")

      {

        switch ($_GET['column'])

        {

            case "title": $rrorder = "title"; break;

            case "added": $rrorder = "added"; break;

            case "visits": $rrorder = "visits"; break;

            case "cashback": $rrorder = "cashback"; break;

            default: $rrorder = "title"; break;

        }

      }

      else

      {

        $rrorder = "title";

      }

 

      if (isset($_GET['order']) && $_GET['order'] != "")

      {

        switch ($_GET['order'])

        {

            case "asc": $rorder = "asc"; break;

            case "desc": $rorder = "desc"; break;

            default: $rorder = "asc"; break;

        }

      }

      else

      {

        $rorder = "asc";

      }

  //////////////////////////////////////////////////

 

  if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; }

 

  $from = ($page-1)*$results_per_page;

  $where = "";

 

  if (isset($_GET['cat']) && is_numeric($_GET['cat']) && $_GET['cat'] > 0)

  {

      $cat_id = (int)$_GET['cat'];

 

      unset($retailers_per_category);

      $retailers_per_category = array();

      $retailers_per_category[] = "111111111111111111111";

 

      $sql_retailers_per_category = smart_mysql_query("SELECT retailer_id FROM cashbackengine_retailer_to_category WHERE category_id='$cat_id'");

      while ($row_retailers_per_category = mysql_fetch_array($sql_retailers_per_category))

      {

        $retailers_per_category[] = $row_retailers_per_category['retailer_id'];

      }

 

      $where .= "retailer_id IN (".implode(",",$retailers_per_category).") AND";

  }

 

  if (isset($_GET['letter']) && in_array($_GET['letter'], $alphabet))

  {

      $ltr = mysql_real_escape_string(getGetParameter('letter'));

 

      if ($ltr == "0-9")

      {

        $where .= " title REGEXP '^[0-9]' AND";

      }else{

        $ltr = substr($ltr, 0, 1);

        $where .= " UPPER(title) LIKE '$ltr%' AND";

      }

  }

 

  $where .= " status='active'";

 

  if ($rrorder == "cashback")

      $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY ABS(cashback) $rorder LIMIT $from, $results_per_page";

  else

      $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY $rrorder $rorder LIMIT $from, $results_per_page";

 

  $total_result = smart_mysql_query("SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY title ASC");

  $total = mysql_num_rows($total_result);

 

  $result = smart_mysql_query($query);

  $total_on_page = mysql_num_rows($result);

 

 

  ///////////////  Page config  ///////////////

  $PAGE_TITLE = getCategory($_GET['cat']);

 

  require_once ("inc/header.inc.php");

 

?>

 

 

  <h1><?php echo getCategory($_GET['cat']); ?></h1>

 

 

<?php

 

  if ($total > 0) {

 

?>

 

  <p class="category_description"><?php echo getCategory($_GET['cat'], 1); ?></p>

 

  <div id="alphabet">

      <ul>

        <li><a href="/retailers.php">All</a></li>

        <?php

 

            $numLetters = count($alphabet);

            $i = 0;

 

            foreach ($alphabet as $letter)

            {

              $i++;

              if ($i == $numLetters) $lilast = ' class="last"'; else $lilast = '';

 

              if (isset($cat_id) && is_numeric($cat_id))

                  echo "<li".$lilast."><a href=\"/retailers.php?cat=$cat_id&letter=$letter\">$letter</a></li>";

              else

                  echo "<li".$lilast."><a href=\"/retailers.php?letter=$letter\">$letter</a></li>";

            }

        ?>

      </ul>

  </div>

 

  <div class="browse_top">

      <div class="sortby">

        <form action="retailers.php" id="form1" name="form1" method="get">

            <span>Sort by:</span>

            <select name="column" id="column" onChange="document.form1.submit()">

              <option value="title" <?php if ($_GET['column'] == "title") echo "selected"; ?>>Name</option>

              <option value="visits" <?php if ($_GET['column'] == "visits") echo "selected"; ?>>Popular</option>

              <option value="added" <?php if ($_GET['column'] == "added") echo "selected"; ?>>Newest</option>

              <option value="cashback" <?php if ($_GET['column'] == "cashback") echo "selected"; ?>>Cashback</option>

            </select>

            <select name="order" id="order" onChange="document.form1.submit()">

              <option value="desc"<?php if ($_GET['order'] == "desc") echo "selected"; ?>>Descending</option>

              <option value="asc" <?php if ($_GET['order'] == "asc") echo "selected"; ?>>Ascending</option>

            </select>

            <?php if ($cat_id) { ?><input type="hidden" name="cat" value="<?php echo $cat_id; ?>" /><?php } ?>

            <?php if ($ltr) { ?><input type="hidden" name="letter" value="<?php echo $ltr; ?>" /><?php } ?>

            <input type="hidden" name="page" value="<?php echo $page; ?>" />

        </form>

      </div>

      <div class="results">

            Showing <?php echo ($from + 1); ?> - <?php echo min($from + $total_on_page, $total); ?> of <?php echo $total; ?>

      </div>

  </div>

 

        <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5">

        <?php

              while ($row = mysql_fetch_array($result))

              {

                  $cc++;

        ?>

            <tr class="<?php if (($cc%2) == 0) echo "even"; else echo "odd"; ?>">

              <td width="125" align="center" valign="middle">

                  <?php if ($row['featured'] == 1) { ?><span class="featured" alt="Featured Retailer" title="Featured Retailer"></span><?php } ?>

                  <div id="shadow"><a href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><img src="<?php if (!stristr($row['image'], 'http')) echo "/img/"; echo $row['image']; ?>" width="<?php echo IMAGE_WIDTH; ?>" height="<?php echo IMAGE_HEIGHT; ?>" alt="<?php echo $row['title']; ?>" title="<?php echo $row['title']; ?>" border="0" class="imgs" /></a></div>

              </td>

              <td align="left" valign="top">

 

                  <table width="100%" border="0" cellspacing="0" cellpadding="3">

                    <tr>

                        <td width="80%" align="left" valign="top">

                          <a class="retailer_title" href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><?php echo $row['title']; ?></a>

                        </td>

                        <td nowrap="nowrap" width="20%" align="right" valign="top">

                          <span class="cashback"><?php echo DisplayCashback($row['cashback']); ?>X Points</span>

                        </td>

                    </tr>

                    <tr>

                        <td colspan="2" valign="middle" align="left"><p class="retailer_description"><?php echo $row['description']; ?> </p></td>

                    </tr>

                    <tr>

                        <td valign="middle" align="left">

                        <?php if ($row['conditions'] != "") { ?>

                          <div class="cashbackengine_tooltip">

                              <a class="conditions" href="#">Conditions</a> <span class="tooltip"><?php echo $row['conditions']; ?></span>

                          </div>

                        <?php } ?>

                          <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=<?php echo $row['retailer_id']; ?>'">Add to Favorites</a>

                        </td>

                        <td valign="middle" align="right">

                          <a class="go2store" href="/go2store.php?id=<?php echo $row['retailer_id']; ?>" target="_blank">Go to Store</a>

                        </td>

                    </tr>

                  </table>

 

              </td>

            </tr>

 

        <?php } ?>

            <tr>

              <td valign="middle" align="center" colspan="2">

              <?php

                    $params = "";

                    if (isset($cat_id) && $cat_id > 0) { $params = "cat=$cat_id&"; }

                    if (isset($ltr) && $ltr != "") { $params = "letter=$ltr&"; }

 

                    echo ShowPagination("retailers",$results_per_page,"retailers.php?".$params."column=$rrorder&order=$rorder&","WHERE ".$where);

              ?>

              </td>

              </tr>

              </table>

 

  <?php }else{ ?>

      <p align="center">There are no stores to list in this category!<br/><br/><a class="goback" href="#" onclick="history.go(-1);return false;">Go Back</a></p>

  <?php } ?>

 

<?php require_once ("inc/footer.inc.php"); ?>

Regards,

Ken Duncan

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.