Expand|Select|Wrap|Line Numbers
- <?
- include("common.php");
- require_once("$HeaderFile");
- if(empty($_GET[Start])){
- $Start = '0';
- }else{
- $Start = $_GET[Start];
- }
- $ByPage = $aset[pagina];
- $query = array();
- if(!empty($_GET[what])){
- $query[] = " (ItemName like '%$_GET[what]%' or ItemDesc like '%$_GET[what]%') ";
- }
- if(!empty($_GET[pagename])){
- $qcatalognum = "SELECT CategoryID FROM categories WHERE CategoryPageName = '$_GET[pagename]'";
- $rcatalognum = mysql_query($qcatalognum) or die(mysql_error());
- $catalognum = mysql_fetch_array($rcatalognum);
- $query[] = " ItemCategory = '$catalognum[CategoryID]' ";
- /*********************************** BEGINNING OF THE BIG IF *****************************/
- if($catalognum[CategoryID]){
- if(!empty($_GET[SubcategoryID])){
- $query[] = " ItemSubcategory = '$_GET[SubcategoryID]' ";
- }
- if(!empty($query)){
- $my_query = implode(" and ", $query);
- $my_query = " WHERE $my_query";
- }
- if(!empty($_GET[ord1])){
- $order_by = " ORDER BY $_GET[ord1] ";
- }else{
- $order_by = " ORDER BY ItemName ";
- }
- // Modified On July 11, 2005 by Patrick Mahoney for Online-Net-Business.Com - Killer SEO Website Builder System
- if ($catalognum > 0) {
- $sel = mysql_query("SELECT CategoryDescInfo FROM categories WHERE CategoryPageName = '$_GET[pagename]'");
- if (mysql_num_rows($sel) > 0) {
- while ($fet = mysql_fetch_array($sel)) {
- ?>
- <table border='0' cellpadding='0' cellspacing='0' width='90%' align='center'>
- <tr>
- <td>
- <p><br />
- <?=$fet['CategoryDescInfo']?>
- <br /></p>
- </td>
- </tr>
- </table>
- <?
- }
- } else echo '';
- } else echo '';
- // End Added Modified
- // include("pagina.php");
- // Show The Catalog Content
- $q1 = "SELECT * FROM items $my_query ORDER BY ItemID LIMIT $Start, $ByPage";
- $r1 = mysql_query($q1) or die(mysql_error());
- if(mysql_num_rows($r1) > '0'){
- $col = "#D7D7D7";
- while($a1 = mysql_fetch_array($r1)){
- if($col == "#ffffff"){
- $col = "#ffffff";
- }else{
- $col = "#ffffff";
- } // old link item.php?item=$a1[ItemID]
- if($PageFolder == "Folder"){
- $result_rows .= "<tr>\n\t<td cellpadding='4' width='100%' align='center'><a href='http://$_SERVER[HTTP_HOST]/$a1[ItemPageName]/'>$a1[ItemName]</a></td>\n\t\n</tr>\n\n";
- }elseif($PageFolder == "Page"){
- $result_rows .= "<tr>\n\t<td cellpadding='4' width='100%' align='center'><a href='http://$_SERVER[HTTP_HOST]/$a1[ItemPageName].html'>$a1[ItemName]</a></td>\n\t\n</tr>\n\n";
- }else{
- echo " - <b>Please Set Your Page View Preference In The Settings Area</b> - ";
- }
- }
- $qnav = "select count(*) from items $my_query";
- $rnav = mysql_query($qnav) or die(mysql_error());
- $anav = mysql_fetch_array($rnav);
- $rows = $anav[0];
- if($rows > $ByPage){
- $NextPrev = "<br /><table align='center' width='400'><tr>";
- $NextPrev .= "<td align='center' cellpadding='4'> | ";
- $pages = ceil($rows/$ByPage);
- for($i = 0; $i <= ($pages); $i++){
- $PageStart = $ByPage*$i;
- $i2 = $i + 1;
- if($PageStart == $Start){
- $links[] = " $i2\n\t ";
- }elseif($PageStart < $rows){
- if($PageFolder == "Folder"){
- $links[] = "<a href=\"http://$_SERVER[HTTP_HOST]/category$PageStart/$_GET[pagename]/\">$i2</a>\n\t ";
- }elseif($PageFolder == "Page"){
- $links[] = "<a href=\"http://$_SERVER[HTTP_HOST]/category$PageStart/$_GET[pagename].html\">$i2</a>\n\t ";
- }else{
- echo " - <b>Please Set Your Page View Preference In The Settings Area</b> - ";
- }
- }
- }
- // Below Is The Original Version Before Mod Rewrite
- // $links[] = "<a href=\"cat.php?Start=$PageStart&what=$_GET[what]&CategoryID=$_GET[CategoryID]&ord1=$_GET[ord1]\">$i2</a>\n\t ";
- // Below Was The First Attempt Before Mod Rewrite That Worked
- // $links[] = "<a href=\"http://$_SERVER[HTTP_HOST]/cat.php?Start=$PageStart&pagename=$_GET[pagename]\">$i2</a>\n\t ";
- $links2 = implode(" | ", $links);
- $NextPrev .= $links2;
- $NextPrev .= "| </td>";
- $NextPrev .= "</tr></table><br />\n";
- }
- include_once("templates/ResultsTemplate.php");
- }else{
- include_once("templates/NoResultsTemplate.php");
- }
- }else{
- /*******************************************************/
- $q1 = "SELECT * FROM items WHERE ItemPageName = '$_GET[pagename]'";
- $r1 = mysql_query($q1) or die(mysql_error());
- $a1 = mysql_fetch_array($r1);
- include_once("templates/ViewItemTemplate.php");
- }
- } /********************************** END OF THE BIG IF **********************************/
- require_once("$FooterFile");
- ?>