Location: PHPKode > projects > FreePHPShoppingCartSoftware > themes_menu_left.inc
<?php

// =======================================================================
// Module name: Themes Menu Left
// File name: themes_menu_left.inc
// Version: 1.0
// Description: This script contains php code that controls the menu
// layout for the left side of the page.
// 
// Comments are included within this script to document changes made to
// the code with each new version of the script. Each comment also lists
// the author's initials to document who made the changes to the code.
//
// Copyright (C) 2006-2010 Dustin Cowell Enterprises
//
// License: GNU General Public License, Version 2
//
// Link: http://www.gnu.org/licenses/gpl-2.0.txt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to:
//
// Free Software Foundation, Inc.
// 51 Franklin Street, Fifth Floor
// Boston, MA  02110-1301 USA
// =======================================================================

// =======================================================================
// Comment - DC - Version 1.0
// =======================================================================

if ($request == "run_install" and $install_type == "express" and $admin_rights == "Admin") {

	$db_create_admin_menu = "CREATE TABLE admin_menu (" . 
		"id int not null auto_increment primary key, " . 
		"menu_categories_id int, " . 
		"name text, " . 
		"include_file text, " . 
		"page text, " .  
		"request text" . 
		")";

	$db_create_admin_menu_categories = "CREATE TABLE admin_menu_categories (" . 
		"id int not null auto_increment primary key, " . 
		"name text" . 
		")";

	echo("<tr>");
	echo("<td>" . $font_body . "Create Admin Menu</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_create_admin_menu)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Create Admin Menu Categories</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_create_admin_menu_categories)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");

	$db_lookup_admin_menu_categories = @mysql_query("SELECT id FROM admin_menu_categories WHERE name='Website'");
	$db_admin_menu_categories = @mysql_fetch_array($db_lookup_admin_menu_categories);
	$db_admin_menu_categories_id = $db_admin_menu_categories['id'];

	if (!$db_admin_menu_categories_id) {
		$db_insert_admin_menu_categories_website = "INSERT INTO admin_menu_categories SET " . 
		"name = 'Website'";

		echo("<tr>");
		echo("<td>" . $font_body . "Insert Admin Menu Categories Website</td>");
		echo("<td>" . $font_body . "");
		if (@mysql_query($db_insert_admin_menu_categories_website)) {
			echo("Successful");
		} else {
			echo("Error");
		}
		echo("</font></td>");
		echo("</tr>");
	}

	$db_lookup_admin_menu_categories = @mysql_query("SELECT id FROM admin_menu_categories WHERE name='Website'");
	$db_admin_menu_categories = @mysql_fetch_array($db_lookup_admin_menu_categories);
	$db_admin_menu_categories_id = $db_admin_menu_categories['id'];

	$db_insert_admin_menu_pages = "INSERT INTO admin_menu SET " . 
		"menu_categories_id = '$db_admin_menu_categories_id', " . 
		"name = 'Menu', " . 
		"include_file = 'themes_menu_left.inc', " . 
		"page = 'menu'";

	echo("<tr>");
	echo("<td>" . $font_body . "Insert Admin Menu Pages</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_insert_admin_menu_pages)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");

	$db_lookup_admin_menu_categories = @mysql_query("SELECT id FROM admin_menu_categories WHERE name='Website'");
	$db_admin_menu_categories = @mysql_fetch_array($db_lookup_admin_menu_categories);
	$db_admin_menu_categories_id = $db_admin_menu_categories['id'];

	$db_insert_admin_menu_users = "INSERT INTO admin_menu SET " . 
		"menu_categories_id = '$db_admin_menu_categories_id', " . 
		"name = 'Users', " . 
		"include_file = 'admin_users.inc', " . 
		"page = 'users'";

	$db_insert_admin_menu_modules = "INSERT INTO admin_menu SET " . 
		"menu_categories_id = '$db_admin_menu_categories_id', " . 
		"name = 'Modules', " . 
		"include_file = 'admin_modules.inc', " . 
		"page = 'modules'";
	
	$db_insert_admin_menu_themes = "INSERT INTO admin_menu SET " . 
		"menu_categories_id = '$db_admin_menu_categories_id', " . 
		"name = 'Themes', " . 
		"include_file = 'themes.inc', " . 
		"page = 'themes'";

//	$db_insert_admin_menu_log = "INSERT INTO admin_menu SET " . 
//		"menu_categories_id = '$db_admin_menu_categories_id', " . 
//		"name = 'Log', " . 
//		"include_file = 'admin_log.inc', " . 
//		"page = 'log'";

	echo("<tr>");
	echo("<td>" . $font_body . "Insert Admin Menu Users</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_insert_admin_menu_users)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Insert Admin Menu Modules</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_insert_admin_menu_modules)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Insert Admin Menu Themes</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_insert_admin_menu_themes)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
//	echo("<tr>");
//	echo("<td>" . $font_body . "Insert Admin Menu Log</font></td>");
//	echo("<td>" . $font_body);
//	if (@mysql_query($db_insert_admin_menu_log)) {
//		echo("Successful");
//	} else {
//		echo("Error");
//	}
//	echo("</font></td>");
//	echo("</tr>");

	$db_create_members_menu = "CREATE TABLE members_menu (" . 
		"id int not null auto_increment primary key, " . 
		"menu_categories_id int, " . 
		"name text, " . 
		"include_file text, " . 
		"page text, " .  
		"request text" . 
		")";

	$db_create_members_menu_categories = "CREATE TABLE members_menu_categories (" . 
		"id int not null auto_increment primary key, " . 
		"name text" . 
		")";

	echo("<tr>");
	echo("<td>" . $font_body . "Create Members Menu</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_create_members_menu)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Create Members Menu Categories</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_create_members_menu_categories)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");

	$db_create_menu = "CREATE TABLE menu (" . 
		"id int not null auto_increment primary key, " . 
		"menu_categories_id int, " . 
		"name text, " . 
		"include_file text, " . 
		"page text, " .  
		"request text" . 
		")";

	$db_create_menu_categories = "CREATE TABLE menu_categories (" . 
		"id int not null auto_increment primary key, " . 
		"left_right text, " . 
		"name text" . 
		")";

	echo("<tr>");
	echo("<td>" . $font_body . "Create Menu</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_create_menu)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Create Menu Categories</font></td>");
	echo("<td>" . $font_body);
	if (@mysql_query($db_create_menu_categories)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");

}

// =======================================================================
// Comment - DC - Version 1.0
// =======================================================================

if ($page == "menu" and !$request and $admin_rights) {
	echo("<b>Menu</b><p>");

	$stop_menu_body = "yes";

	$db_lookup_menu_categories = @mysql_query("SELECT id FROM menu_categories");
	$db_menu_categories = @mysql_fetch_array($db_lookup_menu_categories);
	$db_menu_categories_id = $db_menu_categories['id'];

	if ($db_menu_categories_id) {

		// ==================== START OF PAGE # HEADER ====================

		if ($_POST["results_per_page"]) {
			$results_per_page  = $_POST["results_per_page"];
			$_SESSION['results_per_page'] = $results_per_page;
		} else {
			if (!$_SESSION['results_per_page']) {
				$results_per_page=10;
			}
		}

		if ($_GET["start_page"]) {
			$start_page  = $_GET["start_page"];
		} else {
			$start_page=1;
		}
		$start_from = ($start_page-1) * $results_per_page; 

		echo("<p>");
		echo("<table border='0' cellpadding='0' cellspacing='0' bordercolor='#000000' width='100%'>");
		echo("<tr>");
		echo("<td align='left' width='50%'>" . $font_body);

		echo "<b>Pages:&nbsp;&nbsp;";

		$db_count_pages = @mysql_query("SELECT COUNT(id) FROM menu_categories"); 
		$row = @mysql_fetch_row($db_count_pages); 
		$total_records = $row[0]; 
		$total_start_pages = ceil($total_records / $results_per_page); 

		for ($page_number=1; $page_number<=$total_start_pages; $page_number++) {
			if ($page_number == $start_page) {
				echo "$page_number&nbsp;&nbsp;";
			} else {
				echo "<a href='" . $_SERVER['PHP_SELF'] . "?page=menu&results_per_page=$results_per_page&start_page=".$page_number."'>".$page_number."</a>&nbsp; ";
			}
		}
		echo "</b>";

		echo("</td>");
		echo("<td align='left' width='50%'>" . $font_body);

		echo("<table border='0' cellpadding='2' cellspacing='0'>");
		echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=menu&start_page=".$start_page."' method='post'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>Items per page:</b> </font></td>");
		echo("<td>" . $font_body . "");
		echo("<select size='1' name='results_per_page'>");
		if ($results_per_page == 10) {
			echo("<option value='10' selected>10</option>");
		} else {
			echo("<option value='10'>10</option>");
		}
		if ($results_per_page == 25) {
			echo("<option value='25' selected>25</option>");
		} else {
			echo("<option value='25'>25</option>");
		}
		if ($results_per_page == 50) {
			echo("<option value='50' selected>50</option>");
		} else {
			echo("<option value='50'>50</option>");
		}
		if ($results_per_page == 100) {
			echo("<option value='100' selected>100</option>");
		} else {
			echo("<option value='100'>100</option>");
		}
		if ($results_per_page == 99999) {
			echo("<option value='99999' selected>All</option>");
		} else {
			echo("<option value='99999'>All</option>");
		}
		echo("</select>");
		echo("</font></td>");
		echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Change'></font></td>");
		echo("</tr>");
		echo("</form>");
		echo("</table>");

		echo("</td>");
		echo("</tr>");
		echo("</table>");

		// ==================== END OF PAGE # HEADER ====================

		echo("<p><table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>Section</b></td>");
		echo("<td>" . $font_body . "<b>Display</b></td>");
		echo("<td>" . $font_body . "<b>Actions</b></td>");
		echo("</tr>");
		
		$db_lookup_menu_categories = @mysql_query("SELECT id, name, left_right FROM menu_categories ORDER BY name ASC LIMIT $start_from, $results_per_page");
		
		while ($db_menu_categories = @mysql_fetch_array($db_lookup_menu_categories)) {
			
			$db_menu_categories_id = $db_menu_categories['id'];
			$db_menu_categories_name = $db_menu_categories['name'];
			$db_menu_categories_left_right = $db_menu_categories['left_right'];

			echo("<tr>");
			echo("<td>" . $font_body . $db_menu_categories_name . "</td>");
			echo("<td>" . $font_body . $db_menu_categories_left_right . "</td>");
			echo("<td>". $font_body . "[<a href='" . $_SERVER['PHP_SELF'] . "?page=menu&request=view_menu&menu_categories_id=" . $db_menu_categories_id . "'>" . $link_color . "View</font></a>]&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=menu&request=edit_menu&menu_categories_id=" . $db_menu_categories_id . "'>" . $link_color . "Edit</font></a>]</td>");
			echo("</tr>");
		}
		echo("</table>");

		// ==================== START OF PAGE # FOOTER ====================

		echo("<p>");
		echo("<table border='0' cellpadding='0' cellspacing='0' bordercolor='#000000' width='100%'>");
		echo("<tr>");
		echo("<td align='left' width='50%'>" . $font_body);

		echo "<b>Pages:&nbsp;&nbsp;";

		$db_count_pages = @mysql_query("SELECT COUNT(id) FROM menu_categories"); 
		$row = @mysql_fetch_row($db_count_pages); 
		$total_records = $row[0]; 
		$total_start_pages = ceil($total_records / $results_per_page); 

		for ($page_number=1; $page_number<=$total_start_pages; $page_number++) {
			if ($page_number == $start_page) {
				echo "$page_number&nbsp;&nbsp;";
			} else {
				echo "<a href='" . $_SERVER['PHP_SELF'] . "?page=menu&results_per_page=$results_per_page&start_page=".$page_number."'>".$page_number."</a>&nbsp; ";
			}
		}
		echo "</b>";

		echo("</td>");
		echo("<td align='left' width='50%'>" . $font_body);

		echo("<table border='0' cellpadding='2' cellspacing='0'>");
		echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=menu&start_page=".$start_page."' method='post'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>Items per page:</b> </font></td>");
		echo("<td>" . $font_body . "");
		echo("<select size='1' name='results_per_page'>");
		if ($results_per_page == 10) {
			echo("<option value='10' selected>10</option>");
		} else {
			echo("<option value='10'>10</option>");
		}
		if ($results_per_page == 25) {
			echo("<option value='25' selected>25</option>");
		} else {
			echo("<option value='25'>25</option>");
		}
		if ($results_per_page == 50) {
			echo("<option value='50' selected>50</option>");
		} else {
			echo("<option value='50'>50</option>");
		}
		if ($results_per_page == 100) {
			echo("<option value='100' selected>100</option>");
		} else {
			echo("<option value='100'>100</option>");
		}
		if ($results_per_page == 99999) {
			echo("<option value='99999' selected>All</option>");
		} else {
			echo("<option value='99999'>All</option>");
		}
		echo("</select>");
		echo("</font></td>");
		echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Change'></font></td>");
		echo("</tr>");
		echo("</form>");
		echo("</table>");

		echo("</td>");
		echo("</tr>");
		echo("</table>");

		// ==================== END OF PAGE # FOOTER ====================

	} else {
		echo("No menu categories were found in the database.<p>");
	}
}

// =======================================================================
// Comment - Version 1.0 - DC
// =======================================================================

if ($page == "menu" and $request == "view_menu" and $admin_rights) {
	echo("<b>Menu - View Menu</b><p>");

	$stop_menu_body = "yes";
	
	$menu_categories_id = $_GET['menu_categories_id'];

	$db_lookup_menu_categories = @mysql_query("SELECT name, left_right FROM menu_categories WHERE id='$menu_categories_id'");	
	$db_menu_categories = @mysql_fetch_array($db_lookup_menu_categories);
			
	$db_menu_categories_name = $db_menu_categories['name'];
	$db_menu_categories_left_right = $db_menu_categories['left_right'];

	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Section:</td>");
	echo("<td>" . $font_body . $db_menu_categories_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Display:</td>");
	echo("<td>" . $font_body . $db_menu_categories_left_right . "</td>");
	echo("</tr>");
	echo("</table>");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=menu'>" . $link_color . "Menu</font></a>]<p>");

}

// =======================================================================
// Comment - Version 1.0 - DC
// =======================================================================

if ($page == "menu" and $request == "edit_menu" and $admin_rights == "Admin") {
	echo("<b>Menu - Edit Menu</b><p>");

	$stop_menu_body = "yes";
	
	$menu_categories_id = $_GET['menu_categories_id'];
	
	$db_lookup_menu_categories = @mysql_query("SELECT name, left_right FROM menu_categories WHERE id='$menu_categories_id'");	
	$db_menu_categories = @mysql_fetch_array($db_lookup_menu_categories);
			
	$db_menu_categories_name = $db_menu_categories['name'];
	$db_menu_categories_left_right = $db_menu_categories['left_right'];
	
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=menu&request=edit_menu_submit' method='post'>");
	echo("<input type='hidden' name='menu_categories_id' value='$menu_categories_id'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Section:</font></td>");
	echo("<td>" . $font_body . $db_menu_categories_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Display:</font></td>");
	echo("<td>" . $font_body . "");
	echo("<select name='display'>");
	if ($db_menu_categories_left_right == "Left") {
		echo("<option value='Left' selected>Left</option>");
		echo("<option value='Right'>Right</option>");
	}
	if ($db_menu_categories_left_right == "Right") {
		echo("<option value='Left'>Left</option>");
		echo("<option value='Right' selected>Right</option>");
	}
	echo("</select>");
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Update'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=menu'>" . $link_color . "Menu</font></a>]<p>");
}

// =======================================================================
// Comment - Version 1.0 - DC
// =======================================================================

if ($page == "menu" and $request == "edit_menu_submit" and $admin_rights == "Admin") {
	echo("<b>Menu - Edit Menu</b><p>");

	$stop_menu_body = "yes";

	$menu_categories_id = $_POST['menu_categories_id'];
	$display = $_POST['display'];
	
	$db_insert_menu_categories = "UPDATE menu_categories SET " . 
		"left_right = '$display' " . 
	    "WHERE id = '$menu_categories_id'";
	
	if (@mysql_query($db_insert_menu_categories)) {
		echo("Menu section updated successfully.<p>");
	} else {
		echo("Menu section update error.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=menu'>" . $link_color . "Menu</font></a>]<p>");
}

// =======================================================================
// Comment - Version 1.0 - DC
// =======================================================================

if (!$install_type and $admin_id and !$stop_menu_body) {

	echo("<table border='0' cellpadding='5' cellspacing='0' width='100%'>");
	echo("<tr>");
	echo("<td>" . $font_menu);
	echo("<a href='" . $_SERVER['PHP_SELF'] . "'>" . $link_color . "Home</font></a><br>");
	echo("<a href='" . $_SERVER['PHP_SELF'] . "?logout=logout'>" . $link_color . "Log Out</font></a>");
	echo("&nbsp;");
	echo("</td>");
	echo("</tr>");
	echo("</table>");

	$db_lookup_admin_menu_categories = @mysql_query("SELECT id, name FROM admin_menu_categories");

	while ($db_admin_menu_categories = @mysql_fetch_array($db_lookup_admin_menu_categories)) {

		$db_admin_menu_categories_id = $db_admin_menu_categories['id'];
		$db_admin_menu_categories_name = $db_admin_menu_categories['name'];

		$db_lookup_admin_menu = @mysql_query("SELECT name, page FROM admin_menu WHERE menu_categories_id='$db_admin_menu_categories_id'");
		$db_admin_menu = @mysql_fetch_array($db_lookup_admin_menu);

		if ($db_admin_menu) {

			echo("<table border='0' cellpadding='5' cellspacing='0' width='100%'>");
			echo("<tr>");
			echo("<td>" . $font_menu . "<b>$db_admin_menu_categories_name</b></td>");
			echo("</tr>");
			echo("<tr>");
			echo("<td>");

			$db_lookup_admin_menu = @mysql_query("SELECT name, page FROM admin_menu WHERE menu_categories_id='$db_admin_menu_categories_id' and page != 'link_categories' and page != 'download_settings' and page != 'download_categories' ORDER BY name ASC");
				
				while ($db_admin_menu = @mysql_fetch_array($db_lookup_admin_menu)) {
				
				$db_admin_menu_name = $db_admin_menu['name'];
				$db_admin_menu_page = $db_admin_menu['page'];
				
				echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=" . $db_admin_menu_page . "'>" . $link_color . $db_admin_menu_name . "</font></a><br>");
			}

			echo("</td>");
			echo("</tr>");
			echo("</table>");
		}
	}
}

// =======================================================================
// Comment - Version 1.0 - DC
// =======================================================================

if (!$install_type and $members_id) {

	echo("<table border='0' cellpadding='5' cellspacing='0' width='100%'>");
	echo("<tr>");
	echo("<td>" . $font_menu);
	echo("<a href='" . $_SERVER['PHP_SELF'] . "'>" . $link_color . "Home</font></a><br>");

	$db_lookup_members_menu = @mysql_query("SELECT name, include_file, page FROM members_menu");

	while ($db_members_menu = @mysql_fetch_array($db_lookup_members_menu)) {
		$db_members_menu_name = $db_members_menu['name'];
		$db_members_menu_include_file = $db_members_menu['include_file'];
		$db_members_menu_page = $db_members_menu['page'];
		echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=" . $db_members_menu_page . "'>" . $link_color . $db_members_menu_name . "</font></a><br>");
	}

	echo("<a href='" . $_SERVER['PHP_SELF'] . "?logout=logout'>" . $link_color . "Log Out</font></a>");
	echo("&nbsp;");
	echo("</td>");
	echo("</tr>");
	echo("</table>");
	echo("<br>");

}

// =======================================================================
// Comment - Version 1.0 - DC
// =======================================================================

if (!$install_type and !$admin_id and !$members_id) {

	echo("<table border='0' cellpadding='5' cellspacing='0' width='100%'>");
	echo("<tr>");
	echo("<td>" . $font_menu);
	echo("<a href='" . $_SERVER['PHP_SELF'] . "'>" . $link_color . "Home</font></a><br>");
	echo("<a href='" . $_SERVER['PHP_SELF'] . "?login=member'>" . $link_color . "Login</font></a>");
	echo("&nbsp;");
	echo("</td>");
	echo("</tr>");
	echo("</table>");

	$db_lookup_menu_categories = @mysql_query("SELECT id, name FROM menu_categories WHERE name != 'Links' and left_right='Left' ORDER BY id ASC");

	while ($db_menu_categories = @mysql_fetch_array($db_lookup_menu_categories)) {

		$db_menu_categories_id = $db_menu_categories['id'];
		$db_menu_categories_name = $db_menu_categories['name'];

		$db_lookup_menu = @mysql_query("SELECT name, page FROM menu WHERE menu_categories_id='$db_menu_categories_id' and page != 'view_detail'");
		$db_menu = @mysql_fetch_array($db_lookup_menu);

		if ($db_menu) {

			echo("<table border='0' cellpadding='5' cellspacing='0' width='100%'>");
			echo("<tr>");
			echo("<td>" . $font_menu . "<b>$db_menu_categories_name</b></td>");
			echo("</tr>");
			echo("<tr>");
			echo("<td>");

			if ($db_menu_categories_name == "Shop") {

				$db_lookup_menu = @mysql_query("SELECT name, page, request FROM menu WHERE menu_categories_id='$db_menu_categories_id' and page != 'checkout' and page != 'view_cart' ORDER BY name ASC");
					
				while ($db_menu = @mysql_fetch_array($db_lookup_menu)) {
					
					$db_menu_name = $db_menu['name'];
					$db_menu_page = $db_menu['page'];
					$db_menu_request = $db_menu['request'];

					if ($db_menu_request) {
						echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=$db_menu_page&request=$db_menu_request'>" . $link_color . $db_menu_name . "</font></a><br>");
					} else {
						echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=$db_menu_page'>" . $link_color . $db_menu_name . "</font></a><br>");
					}
				}

				$db_lookup_menu = @mysql_query("SELECT name, page, request FROM menu WHERE menu_categories_id='$db_menu_categories_id' and page != 'checkout' and page != 'view_cart' ORDER BY name ASC");
				$db_menu = @mysql_fetch_array($db_lookup_menu);

				$db_menu_name = $db_menu['name'];

				if ($db_menu_name) {
					echo("<br>");
				}

				$db_lookup_menu = @mysql_query("SELECT name, page, request FROM menu WHERE menu_categories_id='$db_menu_categories_id' and page='checkout' or page='view_cart' ORDER BY name DESC");
					
				while ($db_menu = @mysql_fetch_array($db_lookup_menu)) {
					
					$db_menu_name = $db_menu['name'];
					$db_menu_page = $db_menu['page'];
					$db_menu_request = $db_menu['request'];

					if ($db_menu_request) {
						echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=$db_menu_page&request=$db_menu_request'>" . $link_color . $db_menu_name . "</font></a><br>");
					} else {
						echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=$db_menu_page'>" . $link_color . $db_menu_name . "</font></a><br>");
					}
				}

			} else {

				if ($db_menu_categories_name == "Blog") {

					echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=entries'>" . $link_color . "All Entries</font></a><br>");

					$db_lookup_menu = @mysql_query("SELECT name, page, request FROM menu WHERE menu_categories_id='$db_menu_categories_id' and name != 'All Entries' ORDER BY name ASC");
						
					while ($db_menu = @mysql_fetch_array($db_lookup_menu)) {
						
						$db_menu_name = $db_menu['name'];
						$db_menu_page = $db_menu['page'];
						$db_menu_request = $db_menu['request'];

						if ($db_menu_request) {
							echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=$db_menu_page&request=$db_menu_request'>" . $link_color . $db_menu_name . "</font></a><br>");
						} else {
							echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=$db_menu_page'>" . $link_color . $db_menu_name . "</font></a><br>");
						}
					}
				} else {

					$db_lookup_menu = @mysql_query("SELECT name, page, request FROM menu WHERE menu_categories_id='$db_menu_categories_id' and page != 'home' ORDER BY name ASC");
						
					while ($db_menu = @mysql_fetch_array($db_lookup_menu)) {
						
						$db_menu_name = $db_menu['name'];
						$db_menu_page = $db_menu['page'];
						$db_menu_request = $db_menu['request'];

						if ($db_menu_request) {
							echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=$db_menu_page&request=$db_menu_request'>" . $link_color . $db_menu_name . "</font></a><br>");
						} else {
							echo($font_menu . "<a href='" . $_SERVER['PHP_SELF'] . "?page=$db_menu_page'>" . $link_color . $db_menu_name . "</font></a><br>");
						}
					}
				}
			}

			echo("</td>");
			echo("</tr>");
			echo("</table>");
		}
	}

	$db_lookup_menu_categories = @mysql_query("SELECT left_right FROM menu_categories WHERE name='Links'");
	$db_menu_categories = @mysql_fetch_array($db_lookup_menu_categories);

	$db_menu_categories_left_right = $db_menu_categories['left_right'];

	if ($db_menu_categories_left_right == "Left") {

		$db_lookup_links_categories = @mysql_query("SELECT id, name FROM links_categories ORDER BY name ASC");

		while ($db_links_categories = @mysql_fetch_array($db_lookup_links_categories)) {

			$db_links_categories_id = $db_links_categories['id'];
			$db_links_categories_name = $db_links_categories['name'];

			$db_lookup_links = @mysql_query("SELECT name FROM links WHERE links_categories_id='$db_links_categories_id'");
			$db_links = @mysql_fetch_array($db_lookup_links);

			if ($db_links) {

				echo("<table border='0' cellpadding='5' cellspacing='0' width='100%'>");
				echo("<tr>");
				echo("<td>" . $font_menu . "<b>$db_links_categories_name</b></td>");
				echo("</tr>");
				echo("<tr>");
				echo("<td>");
		
				$db_lookup_links = @mysql_query("SELECT name, url FROM links WHERE links_categories_id='$db_links_categories_id' ORDER BY name ASC");
					
				while ($db_links = @mysql_fetch_array($db_lookup_links)) {
					
					$db_links_name = $db_links['name'];
					$db_links_url = $db_links['url'];

					echo($font_menu . "<a href='$db_links_url'>" . $link_color . $db_links_name . "</font></a><br>");
				}

				echo("</td>");
				echo("</tr>");
				echo("</table>");
			}
		}
	}

	if (file_exists("shop_feed.xml") or file_exists("blog_feed.xml")) {

		echo("<table border='0' cellpadding='5' cellspacing='0' width='100%'>");
		echo("<tr>");
		echo("<td>" . $font_menu . "<b>Feeds</b></td>");
		echo("</tr>");
		echo("<tr>");
		echo("<td>" . $font_menu);
		echo("<table border='0' cellpadding='0' cellspacing='0'>");
		if (file_exists("shop_feed.xml")) {
			echo("<tr>");
			echo("<td>" . $font_menu);
			echo("<img border='0' src='./images/rss.jpg'>");
			echo("</td>");
			echo("<td>");
			echo("&nbsp;");
			echo("</td>");
			echo("<td>" . $font_menu);
			echo("<a href='./shop_feed.xml'>" . $link_color . "Shop</font></a>");
			echo("</td>");
			echo("</tr>");
		}
		if (file_exists("blog_feed.xml")) {
			echo("<tr>");
			echo("<td>" . $font_menu);
			echo("<img border='0' src='./images/rss.jpg'>");
			echo("</td>");
			echo("<td>");
			echo("&nbsp;");
			echo("</td>");
			echo("<td>" . $font_menu);
			echo("<a href='./blog_feed.xml'>" . $link_color . "Blog</font></a>");
			echo("</td>");
			echo("</tr>");
		}
		echo("</table>");
		echo("&nbsp;");
		echo("</td>");
		echo("</tr>");
		echo("</table>");
	}
}

?>
Return current item: FreePHPShoppingCartSoftware