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

// =======================================================================
// Module name: Members
// File name: members.inc
// Version: 1.0
// Description: This script contains php code for the members module.
// The members module allows member information to be stored, edited
// and deleted from the database. Comments are included to explain the
// functions of each section of code in this script.
// 
// 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 - Version 1.0 - DC
// =======================================================================

if ($request == "install" and $admin_rights == "Admin") {
	echo("<b>Members - Install Module</b><p>");
		
	$db_lookup_admin_modules = @mysql_query("SELECT id FROM admin_modules WHERE module_name='members'");
	$db_admin_modules = @mysql_fetch_array($db_lookup_admin_modules);

	if ($db_admin_modules) {
		echo("This module is already installed. The current installation must be uninstalled before a new installation can be created.");
	} else {
		echo("Click the link below to install this module.<p>");
		echo("[<a href='" . $_SERVER['PHP_SELF'] . "?include=$include&request=run_install'>" . $link_color . "Install</font></a>]");
	}
}

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

if ($request == "run_install" and $admin_rights == "Admin") {
	
	if ($install_type != "express") {
		echo("<b>members - Install Module</b><p>");
	}
		
	$db_create_members = "CREATE TABLE members (" . 
		"id int not null auto_increment primary key, " . 
		"date text, " . 
		"time text, " . 
		"first_name text, " . 
		"last_name text, " . 
		"email_address text, " . 
		"password text" .  
		")";

	$db_create_members_billing_addresses = "CREATE TABLE members_billing_addresses (" . 
		"id int not null auto_increment primary key, " . 
		"members_id text, " . 
		"date text, " . 
		"time text, " . 
		"first_name text, " . 
		"last_name text, " . 
		"email_address text, " . 
		"company_name text, " . 
		"address text, " . 
		"address_2 text, " . 
		"city text, " . 
		"state text, " . 
		"zip_code text, " . 
		"phone_1 text, " . 
		"phone_2 text, " . 
		"phone_3 text" . 
		")";

	$db_create_members_shipping_addresses = "CREATE TABLE members_shipping_addresses (" . 
		"id int not null auto_increment primary key, " . 
		"members_id text, " . 
		"date text, " . 
		"time text, " . 
		"first_name text, " . 
		"last_name text, " . 
		"email_address text, " . 
		"company_name text, " . 
		"address text, " . 
		"address_2 text, " . 
		"city text, " . 
		"state text, " . 
		"zip_code text, " . 
		"phone_1 text, " . 
		"phone_2 text, " . 
		"phone_3 text" . 
		")";
		
	$db_insert = "INSERT INTO admin_modules SET " . 
		"module_name = 'Members', " . 
		"file_path = 'members.inc', " . 
		"rights = ' ', " . 
		"install_date = '$date', " . 
		"install_time = '$time'";

	if ($install_type != "express") {
		echo("Members Module Installation Status:<p>");
		echo("<table border='0' cellpadding='5' cellspacing='0'>");
	}
	echo("<tr>");
	echo("<td>" . $font_body . "Members Install</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_create_members)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Members Billing Addresses Install</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_create_members_billing_addresses)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Members Shipping Addresses Install</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_create_members_shipping_addresses)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Module Install</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_insert)) {
		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='Shop'");
	$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_osmc = "INSERT INTO admin_menu_categories SET " . 
		"name = 'Shop'";

		echo("<tr>");
		echo("<td>" . $font_body . "Insert Admin Menu Categories Master</td>");
		echo("<td>" . $font_body . "");
		if (@mysql_query($db_insert_admin_menu_categories_osmc)) {
			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='Shop'");
	$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_members = "INSERT INTO admin_menu SET " . 
		"menu_categories_id = '$db_admin_menu_categories_id', " . 
		"name = 'Members', " . 
		"include_file = 'members.inc', " . 
		"page = 'members'";

	$db_insert_members_menu_profile = "INSERT INTO members_menu SET " . 
		"name = 'Profile', " . 
		"include_file = 'members.inc', " . 
		"page = 'profile'";

	$db_insert_members_menu_addresses = "INSERT INTO members_menu SET " . 
		"name = 'Addresses', " . 
		"include_file = 'members.inc', " . 
		"page = 'addresses'";

	echo("<tr>");
	echo("<td>" . $font_body . "Insert Admin Menu members</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_insert_admin_menu_members)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Insert Members Menu Profile</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_insert_members_menu_profile)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Insert Members Menu Addresses</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_insert_members_menu_addresses)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	if ($install_type != "express") {
		echo("</table>");
		echo("<p>");
	}
}

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

if ($page == "members" and $request == "uninstall" and $admin_rights == "Admin") {
	echo("<b>Members - Uninstall Module</b><p>");

	echo("Click the link below to uninstall this module.<p>");

	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=run_uninstall'>" . $link_color . "Uninstall</font></a>]");
}

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

if ($page == "members" and $request == "run_uninstall" and $admin_rights == "Admin") {
	echo("<b>Members - Uninstall Module</b><p>");

	echo("This module will now be uninstalled...<p>");
	
	$db_delete_members = @mysql_query("DROP TABLE members");
	$db_delete_members_billing_addresses = @mysql_query("DROP TABLE members_billing_addresses");
	$db_delete_members_shipping_addresses = @mysql_query("DROP TABLE members_shipping_addresses");
	$db_delete_module = @mysql_query("DELETE FROM admin_modules WHERE module_name='members'");
	$db_delete_admin_menu_members = "DELETE FROM admin_menu WHERE name='members'";
	$db_delete_members_menu_profile = "DELETE FROM members_menu WHERE name='Profile'";
	$db_delete_members_menu_addresses = "DELETE FROM members_menu WHERE name='Addresses'";

	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Members Uninstall</td>");
	echo("<td>" . $font_body . "");
	if ($db_delete_members) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Members Billing Addresses Uninstall</td>");
	echo("<td>" . $font_body . "");
	if ($db_delete_members_billing_addresses) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Members Shipping Addresses Uninstall</td>");
	echo("<td>" . $font_body . "");
	if ($db_delete_members_shipping_addresses) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Module Uninstall</td>");
	echo("<td>" . $font_body . "");
	if ($db_delete_module) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Members Admin Menu Deletion</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_delete_admin_menu_members)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Profile Members Menu Deletion</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_delete_members_menu_profile)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Addresses Members Menu Deletion</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_delete_members_menu_addresses)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	echo("</table>");
}

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

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

	$db_lookup_members = @mysql_query("SELECT id FROM members");
	$db_members = @mysql_fetch_array($db_lookup_members);
	$db_members_id = $db_members['id'];

	if ($db_members_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_members = @mysql_query("SELECT COUNT(id) FROM members"); 
		$row = @mysql_fetch_row($db_count_members); 
		$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=members&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=members&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>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_member'>" . $link_color . "New</font></a>]");
		echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=search_members'>" . $link_color . "Search</font></a>]<p>");

		$db_lookup_members = @mysql_query("SELECT id, first_name, last_name FROM members ORDER BY first_name ASC LIMIT $start_from, $results_per_page");
		
		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>Name</b></font></td>");
		echo("<td>" . $font_body . "<b>Actions</b></font></td>");
		echo("</tr>");
		
		while ($db_members = @mysql_fetch_array($db_lookup_members)) {
			$db_members_id = $db_members['id'];
			$db_members_first_name = $db_members['first_name'];
			$db_members_last_name = $db_members['last_name'];
			
			echo("<tr>");
			echo("<td>" . $font_body . $db_members_first_name . " " . $db_members_last_name . "</font></td>");
			echo("<td>" . $font_body . "");
			echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_id'>" . $link_color . "View</font></a>]");
			echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=edit_member&members_id=$db_members_id'>" . $link_color . "Edit</font></a>]");
			if ($admin_rights == "Admin") {
				echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member&members_id=$db_members_id'>" . $link_color . "Delete</font></a>]");
			}
			echo("</font></td>");
			echo("</tr>");
		}
		echo("</table>");

		echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_member'>" . $link_color . "New</font></a>]");
		echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=search_members'>" . $link_color . "Search</font></a>]<p>");

		// ==================== 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_members = @mysql_query("SELECT COUNT(id) FROM members"); 
		$row = @mysql_fetch_row($db_count_members); 
		$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=members&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=members&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 members were found in the database.");

		echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_member'>" . $link_color . "New</font></a>]<p>");
	}
}

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

if ($page == "members" and $request == "new_member" and $admin_rights) {
	echo("<b>Members - New Member</b><p>");

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_member_submit' method='post'>");
	echo("<input type='hidden' name='date' value='" . $date . "'>");
	echo("<input type='hidden' name='time' value='" . $time . "'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Password:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='password'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Submit'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");
	
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members'>" . $link_color . "Members</font></a>]");
}

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

if ($page == "members" and $request == "new_member_submit" and $admin_rights) {
	echo("<b>Members - New Member</b><p>");

	$date = $_POST['date'];
	$time = $_POST['time'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$password = $_POST['password'];
	
	$dbinsert = "INSERT INTO members SET " . 
		"date = '$date', " .  
		"time = '$time', " .  
		"first_name = '$first_name', " . 
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " . 
		"password = '$password'";
	
	if (@mysql_query($dbinsert)) {

		$db_lookup_members = @mysql_query("SELECT id FROM members WHERE first_name='$first_name' and last_name='$last_name' and email_address='$email_address'");
		$db_members = @mysql_fetch_array($db_lookup_members);
	
		$db_members_id = $db_members['id'];

		echo("The member has been added to the database.");
		echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_billing_address&members_id=$db_members_id'>" . $link_color . "New Billing Address</font></a>]");
		echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_shipping_address&members_id=$db_members_id'>" . $link_color . "New Shipping Address</font></a>]");
	} else {
		echo("Error adding member to the database.");
	}

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

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

if ($page == "members" and $request == "edit_member" and $admin_rights) {
	echo("<b>Members - Edit Member</b><p>");

	$members_id = $_GET['members_id'];

	$db_lookup_members = @mysql_query("SELECT id, first_name, last_name, email_address FROM members WHERE id='$members_id'");
	$db_members = @mysql_fetch_array($db_lookup_members);
	
	$db_members_id = $db_members['id'];
	$db_members_first_name = $db_members['first_name'];
	$db_members_last_name = $db_members['last_name'];
	$db_members_email_address = $db_members['email_address'];
		
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=members&request=edit_member_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$members_id'>");	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name' value='$db_members_first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name' value='$db_members_last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address' value='$db_members_email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Password:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='password'></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=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "edit_member_submit" and $admin_rights) {
	echo("<b>Members - Edit Member</b><p>");
	
	$members_id = $_POST['members_id'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$password = $_POST['password'];
	
	$dbinsert = "UPDATE members SET " . 
		"first_name = '$first_name', " .  
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " .  
		"password = '$password'" . 
		"WHERE id = '$members_id'";
	
	if (@mysql_query($dbinsert)) {
		echo("Member information has been updated.");
	} else {
		echo("Error updating member information.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member</b><p>");

	$members_id = $_GET['members_id'];
	
	$db_lookup_members = @mysql_query("SELECT id, first_name, last_name, email_address FROM members WHERE id='$members_id'");
	$db_members = @mysql_fetch_array($db_lookup_members);
	
	$db_members_id = $db_members['id'];
	$db_members_first_name = $db_members['first_name'];
	$db_members_last_name = $db_members['last_name'];
	$db_members_email_address = $db_members['email_address'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_first_name . " " . $db_members_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Password:</td>");
	echo("<td>" . $font_body . "**********" . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");
		
	echo("Are you sure you want to delete this member?<p>");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member_submit&members_id=$members_id'>" . $link_color . "Yes</font></a>]&nbsp;");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member_cancel&members_id=$members_id'>" . $link_color . "No</font></a>]");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member_submit" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member</b><p>");
	
	$members_id = $_GET['members_id'];
	
	$db_delete_members = @mysql_query("DELETE FROM members WHERE id='$members_id'");
	$db_delete_members_billing_addresses = @mysql_query("DELETE FROM members_billing_addresses WHERE members_id='$members_id'");
	$db_delete_members_shipping_addresses = @mysql_query("DELETE FROM members_shipping_addresses WHERE members_id='$members_id'");

	if ($db_delete_members and $db_delete_members_billing_addresses and $db_delete_members_shipping_addresses) {
		echo("The member has been deleted.");
	} else {
		echo("Error deleting member.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member_cancel" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member</b><p>");

	$members_id = $_GET['members_id'];

	echo("The member has not been deleted from the database.");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "new_billing_address" and $admin_rights) {
	echo("<b>Members - New Billing Address</b><p>");

	$members_id = $_GET['members_id'];

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_billing_address_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$members_id'>");
	echo("<input type='hidden' name='date' value='" . $date . "'>");
	echo("<input type='hidden' name='time' value='" . $time . "'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='company_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</font></td>");
	echo("<td>" . $font_body . "<table border='0' cellpadding='0' cellspacing='0'><tr><td>" . $font_body . "Address:</td><td><input type='text' name='address'></td></tr><tr><td>" . $font_body . "Address 2: </td><td><input type='text' name='address_2'></td></tr><tr><td>" . $font_body . "City:</td><td><input type='text' name='city'></td></tr><tr><td>" . $font_body . "State:</td><td><input type='text' name='state'></td></tr><tr><td>" . $font_body . "Zip code:</td><td><input type='text' name='zip_code'></td></tr></font></table>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_1'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_2'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_3'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Submit'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");
	
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "new_billing_address_submit" and $admin_rights) {
	echo("<b>Members - New Billing Address</b><p>");

	$members_id = $_POST['members_id'];
	$date = $_POST['date'];
	$time = $_POST['time'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$company_name = $_POST['company_name'];
	$address = $_POST['address'];
	$address_2 = $_POST['address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip_code = $_POST['zip_code'];
	$phone_1 = $_POST['phone_1'];
	$phone_2 = $_POST['phone_2'];
	$phone_3 = $_POST['phone_3'];
	
	$dbinsert = "INSERT INTO members_billing_addresses SET " . 
		"members_id = '$members_id', " .  
		"date = '$date', " .  
		"time = '$time', " . 
		"first_name = '$first_name', " . 
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " . 
		"company_name = '$company_name', " . 
		"address = '$address', " . 
		"address_2 = '$address_2', " . 
		"city = '$city', " . 
		"state = '$state', " . 
		"zip_code = '$zip_code', " . 
		"phone_1 = '$phone_1', " . 
		"phone_2 = '$phone_2', " . 
		"phone_3 = '$phone_3'";
	
	if (@mysql_query($dbinsert)) {
		echo("The address has been added to the database.");
	} else {
		echo("Error adding member to the database.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "new_shipping_address" and $admin_rights) {
	echo("<b>Members - New Shipping Address</b><p>");

	$members_id = $_GET['members_id'];

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_shipping_address_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$members_id'>");
	echo("<input type='hidden' name='date' value='" . $date . "'>");
	echo("<input type='hidden' name='time' value='" . $time . "'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='company_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</font></td>");
	echo("<td>" . $font_body . "<table border='0' cellpadding='0' cellspacing='0'><tr><td>" . $font_body . "Address:</td><td><input type='text' name='address'></td></tr><tr><td>" . $font_body . "Address 2: </td><td><input type='text' name='address_2'></td></tr><tr><td>" . $font_body . "City:</td><td><input type='text' name='city'></td></tr><tr><td>" . $font_body . "State:</td><td><input type='text' name='state'></td></tr><tr><td>" . $font_body . "Zip code:</td><td><input type='text' name='zip_code'></td></tr></font></table>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_1'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_2'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_3'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Submit'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");
	
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "new_shipping_address_submit" and $admin_rights) {
	echo("<b>Members - New Shipping Address</b><p>");

	$members_id = $_POST['members_id'];
	$date = $_POST['date'];
	$time = $_POST['time'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$company_name = $_POST['company_name'];
	$address = $_POST['address'];
	$address_2 = $_POST['address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip_code = $_POST['zip_code'];
	$phone_1 = $_POST['phone_1'];
	$phone_2 = $_POST['phone_2'];
	$phone_3 = $_POST['phone_3'];
	
	$dbinsert = "INSERT INTO members_shipping_addresses SET " . 
		"members_id = '$members_id', " .  
		"date = '$date', " .  
		"time = '$time', " . 
		"first_name = '$first_name', " . 
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " . 
		"company_name = '$company_name', " . 
		"address = '$address', " . 
		"address_2 = '$address_2', " . 
		"city = '$city', " . 
		"state = '$state', " . 
		"zip_code = '$zip_code', " . 
		"phone_1 = '$phone_1', " . 
		"phone_2 = '$phone_2', " . 
		"phone_3 = '$phone_3'";
	
	if (@mysql_query($dbinsert)) {
		echo("The address has been added to the database.");
	} else {
		echo("Error adding member to the database.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "view_member" and $admin_rights) {
	echo("<b>Members - View Member</b><p>");
	
	$members_id = $_GET['members_id'];

	$db_lookup_members = @mysql_query("SELECT id, first_name, last_name, email_address FROM members WHERE id='$members_id'");
	$db_members = @mysql_fetch_array($db_lookup_members);
	
	$db_members_id = $db_members['id'];
	$db_members_first_name = $db_members['first_name'];
	$db_members_last_name = $db_members['last_name'];
	$db_members_email_address = $db_members['email_address'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_first_name . " " . $db_members_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Password:</td>");
	echo("<td>" . $font_body . "**********" . "</td>");
	echo("</tr>");
	echo("</table>");

	echo($font_body . "<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=edit_member&members_id=$db_members_id'>" . $link_color . "Edit</font></a>]&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member&members_id=$db_members_id'>" . $link_color . "Delete</font></a>]");

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id FROM members_billing_addresses");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);

	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];

	if ($db_members_billing_addresses_id) {

		echo("<p><b>Billing Addresses</b><p>");
		
		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>Names</b></font></td>");
		echo("<td>" . $font_body . "<b>Addresses</b></font></td>");
		echo("<td>" . $font_body . "<b>Actions</b></font></td>");
		echo("</tr>");

		$db_lookup_members_billing_addresses = @mysql_query("SELECT id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_billing_addresses WHERE members_id='$members_id'");

		while ($db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses)) {
			
			$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
			$db_members_billing_addresses_first_name = $db_members_billing_addresses['first_name'];
			$db_members_billing_addresses_last_name = $db_members_billing_addresses['last_name'];
			$db_members_billing_addresses_company_name = $db_members_billing_addresses['company_name'];
			$db_members_billing_addresses_address = $db_members_billing_addresses['address'];
			$db_members_billing_addresses_address_2 = $db_members_billing_addresses['address_2'];
			$db_members_billing_addresses_city = $db_members_billing_addresses['city'];
			$db_members_billing_addresses_state = $db_members_billing_addresses['state'];
			$db_members_billing_addresses_zip_code = $db_members_billing_addresses['zip_code'];
			
			echo("<tr>");
			echo("<td>");
			echo($font_body . $db_members_billing_addresses_first_name . " " . $db_members_billing_addresses_last_name . "</font>");
			if ($db_members_billing_addresses_company_name) {
				echo($font_body . "<br>$db_members_billing_addresses_company_name");
			}
			echo("</td>");
			echo("<td>");
			echo($font_body . $db_members_billing_addresses_address . "</font>");
			if ($db_members_billing_addresses_address_2) {
				echo($font_body . "<br>$db_members_billing_addresses_address_2");
			}
			echo($font_body . "<br>" . $db_members_billing_addresses_city . ", " . $db_members_billing_addresses_state . "&nbsp;" . $db_members_billing_addresses_zip_code);
			echo("</td>");
			echo("<td>" . $font_body . "");
			echo($font_body . "[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member_billing_address&members_billing_addresses_id=$db_members_billing_addresses_id'>" . $link_color . "View</font></a>]");
			echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=edit_member_billing_address&members_billing_addresses_id=$db_members_billing_addresses_id'>" . $link_color . "Edit</font></a>]");
			if ($admin_rights == "Admin") {
				echo($font_body . "&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member_billing_address&members_billing_addresses_id=$db_members_billing_addresses_id'>" . $link_color . "Delete</font></a>]");
			}
			echo("</font></td>");
			echo("</tr>");
		}
		echo("</table>");
	
	} else {
	
		echo("<p>No member billing addresses found.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_billing_address&members_id=$db_members_id'>" . $link_color . "New Billing Address</font></a>]");

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id FROM members_shipping_addresses");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);

	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];

	if ($db_members_shipping_addresses_id) {

		echo("<p><b>Shipping Addresses</b><p>");
		
		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>Names</b></font></td>");
		echo("<td>" . $font_body . "<b>Addresses</b></font></td>");
		echo("<td>" . $font_body . "<b>Actions</b></font></td>");
		echo("</tr>");

		$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_shipping_addresses WHERE members_id='$members_id'");

		while ($db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses)) {
			
			$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
			$db_members_shipping_addresses_first_name = $db_members_shipping_addresses['first_name'];
			$db_members_shipping_addresses_last_name = $db_members_shipping_addresses['last_name'];
			$db_members_shipping_addresses_company_name = $db_members_shipping_addresses['company_name'];
			$db_members_shipping_addresses_address = $db_members_shipping_addresses['address'];
			$db_members_shipping_addresses_address_2 = $db_members_shipping_addresses['address_2'];
			$db_members_shipping_addresses_city = $db_members_shipping_addresses['city'];
			$db_members_shipping_addresses_state = $db_members_shipping_addresses['state'];
			$db_members_shipping_addresses_zip_code = $db_members_shipping_addresses['zip_code'];
			
			echo("<tr>");
			echo("<td>");
			echo($font_body . $db_members_shipping_addresses_first_name . " " . $db_members_shipping_addresses_last_name . "</font>");
			if ($db_members_shipping_addresses_company_name) {
				echo($font_body . "<br>$db_members_shipping_addresses_company_name");
			}
			echo("</td>");
			echo("<td>");
			echo($font_body . $db_members_shipping_addresses_address . "</font>");
			if ($db_members_shipping_addresses_address_2) {
				echo($font_body . "<br>$db_members_shipping_addresses_address2");
			}
			echo($font_body . "<br>" . $db_members_shipping_addresses_city . ", " . $db_members_shipping_addresses_state . "&nbsp;" . $db_members_shipping_addresses_zip_code);
			echo("</td>");
			echo("<td>" . $font_body . "");
			echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member_shipping_address&members_shipping_addresses_id=$db_members_shipping_addresses_id'>" . $link_color . "View</font></a>]");
			echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=edit_member_shipping_address&members_shipping_addresses_id=$db_members_shipping_addresses_id'>" . $link_color . "Edit</font></a>]");
			if ($admin_rights == "Admin") {
				echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member_shipping_address&members_shipping_addresses_id=$db_members_shipping_addresses_id'>" . $link_color . "Delete</font></a>]");
			}
			echo("</font></td>");
			echo("</tr>");
		}
		echo("</table>");
	
	} else {
	
		echo("<p>No member shipping addresses found.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=new_shipping_address&members_id=$db_members_id'>" . $link_color . "New Shipping Address</font></a>]");
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members'>" . $link_color . "Members</font></a>]");
}

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

if ($page == "members" and $request == "view_member_billing_address" and $admin_rights) {
	echo("<b>Members - View Member Billing Address</b><p>");
	
	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);
	
	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
	$db_members_billing_addresses_first_name = $db_members_billing_addresses['first_name'];
	$db_members_billing_addresses_last_name = $db_members_billing_addresses['last_name'];
	$db_members_billing_addresses_email_address = $db_members_billing_addresses['email_address'];
	$db_members_billing_addresses_company_name = $db_members_billing_addresses['company_name'];
	$db_members_billing_addresses_address = $db_members_billing_addresses['address'];
	$db_members_billing_addresses_address_2 = $db_members_billing_addresses['address_2'];
	$db_members_billing_addresses_city = $db_members_billing_addresses['city'];
	$db_members_billing_addresses_state = $db_members_billing_addresses['state'];
	$db_members_billing_addresses_zip_code = $db_members_billing_addresses['zip_code'];
	$db_members_billing_addresses_phone_1 = $db_members_billing_addresses['phone_1'];
	$db_members_billing_addresses_phone_2 = $db_members_billing_addresses['phone_2'];
	$db_members_billing_addresses_phone_3 = $db_members_billing_addresses['phone_3'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_first_name . " " . $db_members_billing_addresses_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_company_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</td>");
	echo("<td>");
	echo($font_body . $db_members_billing_addresses_address . "</font>");
	if ($db_members_billing_addresses_address_2) {
		echo($font_body . "<br>$db_members_billing_addresses_address_2");
	}
	echo($font_body . "<br>" . $db_members_billing_addresses_city . ", " . $db_members_billing_addresses_state . "&nbsp;" . $db_members_billing_addresses_zip_code);
	echo("</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_1 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_2 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_3 . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_billing_addresses_members_id'>" . $link_color . "View Member</font></a>]");

}

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

if ($page == "members" and $request == "edit_member_billing_address" and $admin_rights) {
	echo("<b>Members - Edit Member Billing Address</b><p>");

	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);
	
	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
	$db_members_billing_addresses_first_name = $db_members_billing_addresses['first_name'];
	$db_members_billing_addresses_last_name = $db_members_billing_addresses['last_name'];
	$db_members_billing_addresses_email_address = $db_members_billing_addresses['email_address'];
	$db_members_billing_addresses_company_name = $db_members_billing_addresses['company_name'];
	$db_members_billing_addresses_address = $db_members_billing_addresses['address'];
	$db_members_billing_addresses_address_2 = $db_members_billing_addresses['address_2'];
	$db_members_billing_addresses_city = $db_members_billing_addresses['city'];
	$db_members_billing_addresses_state = $db_members_billing_addresses['state'];
	$db_members_billing_addresses_zip_code = $db_members_billing_addresses['zip_code'];
	$db_members_billing_addresses_phone_1 = $db_members_billing_addresses['phone_1'];
	$db_members_billing_addresses_phone_2 = $db_members_billing_addresses['phone_2'];
	$db_members_billing_addresses_phone_3 = $db_members_billing_addresses['phone_3'];
		
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=members&request=edit_member_billing_address_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$db_members_billing_addresses_members_id'>");
	echo("<input type='hidden' name='members_billing_addresses_id' value='$members_billing_addresses_id'>");	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name' value='$db_members_billing_addresses_first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name' value='$db_members_billing_addresses_last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address' value='$db_members_billing_addresses_email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='company_name' value='$db_members_billing_addresses_company_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</font></td>");
	echo("<td>" . $font_body . "<table border='0' cellpadding='0' cellspacing='0'><tr><td>" . $font_body . "Address:</td><td><input type='text' name='address' value='$db_members_billing_addresses_address'></td></tr><tr><td>" . $font_body . "Address 2: </td><td><input type='text' name='address_2' value='$db_members_billing_addresses_address_2'></td></tr><tr><td>" . $font_body . "City:</td><td><input type='text' name='city' value='$db_members_billing_addresses_city'></td></tr><tr><td>" . $font_body . "State:</td><td><input type='text' name='state' value='$db_members_billing_addresses_state'></td></tr><tr><td>" . $font_body . "Zip code:</td><td><input type='text' name='zip_code' value='$db_members_billing_addresses_zip_code'></td></tr></font></table>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_1' value='$db_members_billing_addresses_phone_1'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_2' value='$db_members_billing_addresses_phone_2'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_3' value='$db_members_billing_addresses_phone_3'></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=members&request=view_member&members_id=$db_members_billing_addresses_members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "edit_member_billing_address_submit" and $admin_rights) {
	echo("<b>Members - Edit Member Billing Address</b><p>");
	
	$members_id = $_POST['members_id'];
	$members_billing_addresses_id = $_POST['members_billing_addresses_id'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$company_name = $_POST['company_name'];
	$address = $_POST['address'];
	$address_2 = $_POST['address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip_code = $_POST['zip_code'];
	$phone_1 = $_POST['phone_1'];
	$phone_2 = $_POST['phone_2'];
	$phone_3 = $_POST['phone_3'];
	
	$dbinsert = "UPDATE members_billing_addresses SET " . 
		"first_name = '$first_name', " .  
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " .  
		"company_name = '$company_name', " . 
		"address = '$address', " . 
		"address_2 = '$address_2', " . 
		"city = '$city', " . 
		"state = '$state', " . 
		"zip_code = '$zip_code', " . 
		"phone_1 = '$phone_1', " . 
		"phone_2 = '$phone_2', " . 
		"phone_3 = '$phone_3'" . 
		"WHERE id = '$members_billing_addresses_id'";
	
	if (@mysql_query($dbinsert)) {
		echo("Member billing address has been updated.");
	} else {
		echo("Error updating member billing address.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member_billing_address" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member Billing Address</b><p>");
	
	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);
	
	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
	$db_members_billing_addresses_first_name = $db_members_billing_addresses['first_name'];
	$db_members_billing_addresses_last_name = $db_members_billing_addresses['last_name'];
	$db_members_billing_addresses_email_address = $db_members_billing_addresses['email_address'];
	$db_members_billing_addresses_company_name = $db_members_billing_addresses['company_name'];
	$db_members_billing_addresses_address = $db_members_billing_addresses['address'];
	$db_members_billing_addresses_address_2 = $db_members_billing_addresses['address_2'];
	$db_members_billing_addresses_city = $db_members_billing_addresses['city'];
	$db_members_billing_addresses_state = $db_members_billing_addresses['state'];
	$db_members_billing_addresses_zip_code = $db_members_billing_addresses['zip_code'];
	$db_members_billing_addresses_phone_1 = $db_members_billing_addresses['phone_1'];
	$db_members_billing_addresses_phone_2 = $db_members_billing_addresses['phone_2'];
	$db_members_billing_addresses_phone_3 = $db_members_billing_addresses['phone_3'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_first_name . " " . $db_members_billing_addresses_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_company_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</td>");
	echo("<td>");
	echo($font_body . $db_members_billing_addresses_address . "</font>");
	if ($db_members_billing_addresses_address_2) {
		echo($font_body . "<br>$db_members_billing_addresses_address_2");
	}
	echo($font_body . "<br>" . $db_members_billing_addresses_city . ", " . $db_members_billing_addresses_state . "&nbsp;" . $db_members_billing_addresses_zip_code);
	echo("</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_1 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_2 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_3 . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");
		
	echo("Are you sure you want to delete this member billing address?<p>");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member_billing_address_submit&members_billing_addresses_id=$members_billing_addresses_id'>" . $link_color . "Yes</font></a>]&nbsp;");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member_billing_address_cancel&members_billing_addresses_id=$members_billing_addresses_id'>" . $link_color . "No</font></a>]");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_billing_addresses_members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member_billing_address_submit" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member Billing Address</b><p>");
	
	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);

	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
	
	$db_delete_members_billing_addresses = @mysql_query("DELETE FROM members_billing_addresses WHERE id='$db_members_billing_addresses_id'");

	if ($db_delete_members_billing_addresses) {
		echo("The member billing address been deleted.");
	} else {
		echo("Error deleting member billing address.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_billing_addresses_members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member_billing_address_cancel" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member Billing Address</b><p>");

	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT members_id FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);

	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];

	echo("The member billing address has not been deleted from the database.");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_billing_addresses_members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "view_member_shipping_address" and $admin_rights) {
	echo("<b>Members - View Member Shipping Address</b><p>");
	
	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);
	
	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
	$db_members_shipping_addresses_first_name = $db_members_shipping_addresses['first_name'];
	$db_members_shipping_addresses_last_name = $db_members_shipping_addresses['last_name'];
	$db_members_shipping_addresses_email_address = $db_members_shipping_addresses['email_address'];
	$db_members_shipping_addresses_company_name = $db_members_shipping_addresses['company_name'];
	$db_members_shipping_addresses_address = $db_members_shipping_addresses['address'];
	$db_members_shipping_addresses_address_2 = $db_members_shipping_addresses['address_2'];
	$db_members_shipping_addresses_city = $db_members_shipping_addresses['city'];
	$db_members_shipping_addresses_state = $db_members_shipping_addresses['state'];
	$db_members_shipping_addresses_zip_code = $db_members_shipping_addresses['zip_code'];
	$db_members_shipping_addresses_phone_1 = $db_members_shipping_addresses['phone_1'];
	$db_members_shipping_addresses_phone_2 = $db_members_shipping_addresses['phone_2'];
	$db_members_shipping_addresses_phone_3 = $db_members_shipping_addresses['phone_3'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_first_name . " " . $db_members_shipping_addresses_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_company_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</td>");
	echo("<td>");
	echo($font_body . $db_members_shipping_addresses_address . "</font>");
	if ($db_members_shipping_addresses_address_2) {
		echo($font_body . "<br>$db_members_shipping_addresses_address_2");
	}
	echo($font_body . "<br>" . $db_members_shipping_addresses_city . ", " . $db_members_shipping_addresses_state . "&nbsp;" . $db_members_shipping_addresses_zip_code);
	echo("</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_1 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_2 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_3 . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_shipping_addresses_members_id'>" . $link_color . "View Member</font></a>]");

}

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

if ($page == "members" and $request == "edit_member_shipping_address" and $admin_rights) {
	echo("<b>Members - Edit Member Shipping Address</b><p>");

	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);
	
	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
	$db_members_shipping_addresses_first_name = $db_members_shipping_addresses['first_name'];
	$db_members_shipping_addresses_last_name = $db_members_shipping_addresses['last_name'];
	$db_members_shipping_addresses_email_address = $db_members_shipping_addresses['email_address'];
	$db_members_shipping_addresses_company_name = $db_members_shipping_addresses['company_name'];
	$db_members_shipping_addresses_address = $db_members_shipping_addresses['address'];
	$db_members_shipping_addresses_address_2 = $db_members_shipping_addresses['address_2'];
	$db_members_shipping_addresses_city = $db_members_shipping_addresses['city'];
	$db_members_shipping_addresses_state = $db_members_shipping_addresses['state'];
	$db_members_shipping_addresses_zip_code = $db_members_shipping_addresses['zip_code'];
	$db_members_shipping_addresses_phone_1 = $db_members_shipping_addresses['phone_1'];
	$db_members_shipping_addresses_phone_2 = $db_members_shipping_addresses['phone_2'];
	$db_members_shipping_addresses_phone_3 = $db_members_shipping_addresses['phone_3'];
		
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=members&request=edit_member_shipping_address_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$db_members_shipping_addresses_members_id'>");
	echo("<input type='hidden' name='members_shipping_addresses_id' value='$members_shipping_addresses_id'>");	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name' value='$db_members_shipping_addresses_first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name' value='$db_members_shipping_addresses_last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address' value='$db_members_shipping_addresses_email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='company_name' value='$db_members_shipping_addresses_company_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</font></td>");
	echo("<td>" . $font_body . "<table border='0' cellpadding='0' cellspacing='0'><tr><td>" . $font_body . "Address:</td><td><input type='text' name='address' value='$db_members_shipping_addresses_address'></td></tr><tr><td>" . $font_body . "Address 2: </td><td><input type='text' name='address_2' value='$db_members_shipping_addresses_address_2'></td></tr><tr><td>" . $font_body . "City:</td><td><input type='text' name='city' value='$db_members_shipping_addresses_city'></td></tr><tr><td>" . $font_body . "State:</td><td><input type='text' name='state' value='$db_members_shipping_addresses_state'></td></tr><tr><td>" . $font_body . "Zip code:</td><td><input type='text' name='zip_code' value='$db_members_shipping_addresses_zip_code'></td></tr></font></table>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_1' value='$db_members_shipping_addresses_phone_1'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_2' value='$db_members_shipping_addresses_phone_2'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_3' value='$db_members_shipping_addresses_phone_3'></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=members&request=view_member&members_id=$db_members_shipping_addresses_members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "edit_member_shipping_address_submit" and $admin_rights) {
	echo("<b>Members - Edit Member Shipping Address</b><p>");
	
	$members_id = $_POST['members_id'];
	$members_shipping_addresses_id = $_POST['members_shipping_addresses_id'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$company_name = $_POST['company_name'];
	$address = $_POST['address'];
	$address_2 = $_POST['address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip_code = $_POST['zip_code'];
	$phone_1 = $_POST['phone_1'];
	$phone_2 = $_POST['phone_2'];
	$phone_3 = $_POST['phone_3'];
	
	$dbinsert = "UPDATE members_shipping_addresses SET " . 
		"first_name = '$first_name', " .  
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " .  
		"company_name = '$company_name', " . 
		"address = '$address', " . 
		"address_2 = '$address_2', " . 
		"city = '$city', " . 
		"state = '$state', " . 
		"zip_code = '$zip_code', " . 
		"phone_1 = '$phone_1', " . 
		"phone_2 = '$phone_2', " . 
		"phone_3 = '$phone_3'" . 
		"WHERE id = '$members_shipping_addresses_id'";
	
	if (@mysql_query($dbinsert)) {
		echo("Member shipping address has been updated.");
	} else {
		echo("Error updating member shipping address.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member_shipping_address" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member Shipping Address</b><p>");
	
	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);
	
	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
	$db_members_shipping_addresses_first_name = $db_members_shipping_addresses['first_name'];
	$db_members_shipping_addresses_last_name = $db_members_shipping_addresses['last_name'];
	$db_members_shipping_addresses_email_address = $db_members_shipping_addresses['email_address'];
	$db_members_shipping_addresses_company_name = $db_members_shipping_addresses['company_name'];
	$db_members_shipping_addresses_address = $db_members_shipping_addresses['address'];
	$db_members_shipping_addresses_address_2 = $db_members_shipping_addresses['address_2'];
	$db_members_shipping_addresses_city = $db_members_shipping_addresses['city'];
	$db_members_shipping_addresses_state = $db_members_shipping_addresses['state'];
	$db_members_shipping_addresses_zip_code = $db_members_shipping_addresses['zip_code'];
	$db_members_shipping_addresses_phone_1 = $db_members_shipping_addresses['phone_1'];
	$db_members_shipping_addresses_phone_2 = $db_members_shipping_addresses['phone_2'];
	$db_members_shipping_addresses_phone_3 = $db_members_shipping_addresses['phone_3'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_first_name . " " . $db_members_shipping_addresses_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_company_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</td>");
	echo("<td>");
	echo($font_body . $db_members_shipping_addresses_address . "</font>");
	if ($db_members_shipping_addresses_address_2) {
		echo($font_body . "<br>$db_members_shipping_addresses_address_2");
	}
	echo($font_body . "<br>" . $db_members_shipping_addresses_city . ", " . $db_members_shipping_addresses_state . "&nbsp;" . $db_members_shipping_addresses_zip_code);
	echo("</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_1 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_2 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_3 . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");
		
	echo("Are you sure you want to delete this member shipping address?<p>");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member_shipping_address_submit&members_shipping_addresses_id=$members_shipping_addresses_id'>" . $link_color . "Yes</font></a>]&nbsp;");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member_shipping_address_cancel&members_shipping_addresses_id=$members_shipping_addresses_id'>" . $link_color . "No</font></a>]");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_shipping_addresses_members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member_shipping_address_submit" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member Shipping Address</b><p>");
	
	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);

	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
	
	$db_delete_members_shipping_addresses = @mysql_query("DELETE FROM members_shipping_addresses WHERE id='$db_members_shipping_addresses_id'");

	if ($db_delete_members_shipping_addresses) {
		echo("The member shipping address been deleted.");
	} else {
		echo("Error deleting member shipping address.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_shipping_addresses_members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "delete_member_shipping_address_cancel" and $admin_rights == "Admin") {
	echo("<b>Members - Delete Member Shipping Address</b><p>");

	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT members_id FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);

	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];

	echo("The member shipping address has not been deleted from the database.");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_shipping_addresses_members_id'>" . $link_color . "View Member</font></a>]");
}

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

if ($page == "members" and $request == "search_members" and $admin_rights) {
	echo("<b>Members - Search Members</b><p>");

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=members&request=search_members_submit' method='post'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'");
	echo("<tr>");
	echo("<td valign='top' align='left'>" . $font_body . "First name: </td></font>");
	echo("<td>" . $font_body . " ");
	echo("<input type='text' name='first_name'> ");
	echo("</td>");
	echo("<td>" . $font_body . " ");
	echo("<input type='submit' name ='submit' value ='Search'>");
	echo("</td>");
	echo("</tr>");
	echo("</form>");
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=members&request=search_members_submit' method='post'>");
	echo("<tr>");
	echo("<td valign='top' align='left'>" . $font_body . "Last name: </td></font>");
	echo("<td>" . $font_body . " ");
	echo("<input type='text' name='last_name'> ");
	echo("</td>");
	echo("<td>" . $font_body . " ");
	echo("<input type='submit' name ='submit' value ='Search'>");
	echo("</td>");
	echo("</tr>");
	echo("</form>");
	echo("</table>");
	echo($font_body . "<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members'>" . $link_color . "Members</font></a>]");
}

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

if ($page == "members" and $request == "search_members_submit" and $admin_rights) {
	echo("<b>Members - Search Members</b><p><p>");

	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];

	if ($first_name) {
			$db_lookup_members = @mysql_query("SELECT id, first_name, last_name FROM members WHERE first_name='$first_name'");
	}
	if ($last_name) {
			$db_lookup_members = @mysql_query("SELECT id, first_name, last_name FROM members WHERE last_name='$last_name'");
	}

	$db_members = @mysql_fetch_array($db_lookup_members);
	
	$db_members_id = $db_members['id'];

	if ($db_members_id) {
		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>First Name</b></td>");
		echo("<td>" . $font_body . "<b>Last Name</b></td>");
		echo("<td>" . $font_body . "<b>Actions</b></td>");
		echo("</tr>");

		if ($first_name) {
			$db_lookup_members = @mysql_query("SELECT id, first_name, last_name FROM members WHERE first_name='$first_name'");
		}
		if ($last_name) {
				$db_lookup_members = @mysql_query("SELECT id, first_name, last_name FROM members WHERE last_name='$last_name'");
		}

		while ($db_members = @mysql_fetch_array($db_lookup_members)) {

			$db_members_id = $db_members['id'];
			$db_members_first_name = $db_members['first_name'];
			$db_members_last_name = $db_members['last_name'];

			echo("<tr>");
			echo("<td>" . $font_body . $db_members_first_name . "</td>");
			echo("<td>" . $font_body . $db_members_last_name . "</td>");
			echo("<td>". $font_body . "[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=view_member&members_id=$db_members_id'>" . $link_color . "View</font></a>]&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=edit_member&members_id=$db_members_id'>" . $link_color . "Edit</font></a>]&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=delete_member&members_id=$db_members_id'>" . $link_color . "Delete</font></a>]</td>");
			echo("</tr>");
		}
		echo("</table>");
	} else {
		echo("Sorry, there were no results found matching \"" . $first_name . $last_name . "\".");
	}
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members&request=search_members'>" . $link_color . "Search</font></a>]<p>");
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=members'>" . $link_color . "Members</font></a>]");
}

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

if ($page == "addresses" and !$request and $members_id) {

	echo("<b>Addresses</b><p>");

	$db_lookup_members = @mysql_query("SELECT id FROM members WHERE email_address='$members_email_address'");
	$db_members = @mysql_fetch_array($db_lookup_members);
	
	$db_members_id = $db_members['id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id FROM members_billing_addresses WHERE members_id='$db_members_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);

	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];

	if ($db_members_billing_addresses_id) {

		echo("<p><b>Billing Addresses</b><p>");
		
		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>Names</b></font></td>");
		echo("<td>" . $font_body . "<b>Addresses</b></font></td>");
		echo("<td>" . $font_body . "<b>Actions</b></font></td>");
		echo("</tr>");

		$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_billing_addresses WHERE members_id='$db_members_id' ORDER BY id DESC");

		while ($db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses)) {
			
			$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
			$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
			$db_members_billing_addresses_first_name = $db_members_billing_addresses['first_name'];
			$db_members_billing_addresses_last_name = $db_members_billing_addresses['last_name'];
			$db_members_billing_addresses_company_name = $db_members_billing_addresses['company_name'];
			$db_members_billing_addresses_address = $db_members_billing_addresses['address'];
			$db_members_billing_addresses_address_2 = $db_members_billing_addresses['address_2'];
			$db_members_billing_addresses_city = $db_members_billing_addresses['city'];
			$db_members_billing_addresses_state = $db_members_billing_addresses['state'];
			$db_members_billing_addresses_zip_code = $db_members_billing_addresses['zip_code'];
			
			echo("<tr>");
			echo("<td>");
			echo($font_body . $db_members_billing_addresses_first_name . " " . $db_members_billing_addresses_last_name . "</font>");
			if ($db_members_billing_addresses_company_name) {
				echo($font_body . "<br>$db_members_billing_addresses_company_name");
			}
			echo("</td>");
			echo("<td>");
			echo($font_body . $db_members_billing_addresses_address . "</font>");
			if ($db_members_billing_addresses_address_2) {
				echo($font_body . "<br>$db_members_billing_addresses_address_2");
			}
			echo($font_body . "<br>" . $db_members_billing_addresses_city . ", " . $db_members_billing_addresses_state . "&nbsp;" . $db_members_billing_addresses_zip_code);
			echo("</td>");
			echo("<td>" . $font_body . "");
			echo($font_body . "[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=view_member_billing_address&members_billing_addresses_id=$db_members_billing_addresses_id'>" . $link_color . "View</font></a>]");
			echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=edit_member_billing_address&members_billing_addresses_id=$db_members_billing_addresses_id'>" . $link_color . "Edit</font></a>]");
			echo($font_body . "&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=delete_member_billing_address&members_billing_addresses_id=$db_members_billing_addresses_id'>" . $link_color . "Delete</font></a>]");
			echo("</font></td>");
			echo("</tr>");
		}
		echo("</table>");
	
	} else {
	
		echo("<p>No member billing addresses found.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=new_billing_address&members_id=$db_members_id'>" . $link_color . "New Billing Address</font></a>]");

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id FROM members_shipping_addresses WHERE members_id='$db_members_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);

	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];

	if ($db_members_shipping_addresses_id) {

		echo("<p><b>Shipping Addresses</b><p>");
		
		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "<b>Names</b></font></td>");
		echo("<td>" . $font_body . "<b>Addresses</b></font></td>");
		echo("<td>" . $font_body . "<b>Actions</b></font></td>");
		echo("</tr>");

		$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_shipping_addresses WHERE members_id='$db_members_id' ORDER BY id DESC");

		while ($db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses)) {
			
			$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
			$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
			$db_members_shipping_addresses_first_name = $db_members_shipping_addresses['first_name'];
			$db_members_shipping_addresses_last_name = $db_members_shipping_addresses['last_name'];
			$db_members_shipping_addresses_company_name = $db_members_shipping_addresses['company_name'];
			$db_members_shipping_addresses_address = $db_members_shipping_addresses['address'];
			$db_members_shipping_addresses_address_2 = $db_members_shipping_addresses['address_2'];
			$db_members_shipping_addresses_city = $db_members_shipping_addresses['city'];
			$db_members_shipping_addresses_state = $db_members_shipping_addresses['state'];
			$db_members_shipping_addresses_zip_code = $db_members_shipping_addresses['zip_code'];
			
			echo("<tr>");
			echo("<td>");
			echo($font_body . $db_members_shipping_addresses_first_name . " " . $db_members_shipping_addresses_last_name . "</font>");
			if ($db_members_shipping_addresses_company_name) {
				echo($font_body . "<br>$db_members_shipping_addresses_company_name");
			}
			echo("</td>");
			echo("<td>");
			echo($font_body . $db_members_shipping_addresses_address . "</font>");
			if ($db_members_shipping_addresses_address_2) {
				echo($font_body . "<br>$db_members_shipping_addresses_address2");
			}
			echo($font_body . "<br>" . $db_members_shipping_addresses_city . ", " . $db_members_shipping_addresses_state . "&nbsp;" . $db_members_shipping_addresses_zip_code);
			echo("</td>");
			echo("<td>" . $font_body . "");
			echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=view_member_shipping_address&members_shipping_addresses_id=$db_members_shipping_addresses_id'>" . $link_color . "View</font></a>]");
			echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=edit_member_shipping_address&members_shipping_addresses_id=$db_members_shipping_addresses_id'>" . $link_color . "Edit</font></a>]");
			echo("&nbsp;[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=delete_member_shipping_address&members_shipping_addresses_id=$db_members_shipping_addresses_id'>" . $link_color . "Delete</font></a>]");
			echo("</font></td>");
			echo("</tr>");
		}
		echo("</table>");
	
	} else {
	
		echo("<p>No member shipping addresses found.");
	}

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=new_shipping_address&members_id=$db_members_id'>" . $link_color . "New Shipping Address</font></a>]");

}

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

if ($page == "addresses" and $request == "new_billing_address" and $members_id) {
	echo("<b>Addresses - New Billing Address</b><p>");

	$members_id = $_GET['members_id'];

	echo("member id: $members_id");

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=new_billing_address_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$members_id'>");
	echo("<input type='hidden' name='date' value='" . $date . "'>");
	echo("<input type='hidden' name='time' value='" . $time . "'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='company_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</font></td>");
	echo("<td>" . $font_body . "<table border='0' cellpadding='0' cellspacing='0'><tr><td>" . $font_body . "Address:</td><td><input type='text' name='address'></td></tr><tr><td>" . $font_body . "Address 2: </td><td><input type='text' name='address_2'></td></tr><tr><td>" . $font_body . "City:</td><td><input type='text' name='city'></td></tr><tr><td>" . $font_body . "State:</td><td><input type='text' name='state'></td></tr><tr><td>" . $font_body . "Zip code:</td><td><input type='text' name='zip_code'></td></tr></font></table>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_1'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_2'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_3'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Submit'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");
	
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses'>" . $link_color . "Addresses</font></a>]");
}

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

if ($page == "addresses" and $request == "new_billing_address_submit" and $members_id) {
	echo("<b>Addresses - New Billing Address</b><p>");

	$members_id = $_POST['members_id'];
	$date = $_POST['date'];
	$time = $_POST['time'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$company_name = $_POST['company_name'];
	$address = $_POST['address'];
	$address_2 = $_POST['address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip_code = $_POST['zip_code'];
	$phone_1 = $_POST['phone_1'];
	$phone_2 = $_POST['phone_2'];
	$phone_3 = $_POST['phone_3'];
	
	$dbinsert = "INSERT INTO members_billing_addresses SET " . 
		"members_id = '$members_id', " .  
		"date = '$date', " .  
		"time = '$time', " . 
		"first_name = '$first_name', " . 
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " . 
		"company_name = '$company_name', " . 
		"address = '$address', " . 
		"address_2 = '$address_2', " . 
		"city = '$city', " . 
		"state = '$state', " . 
		"zip_code = '$zip_code', " . 
		"phone_1 = '$phone_1', " . 
		"phone_2 = '$phone_2', " . 
		"phone_3 = '$phone_3'";
	
	if (@mysql_query($dbinsert)) {
		echo("The address has been added to the database.");
	} else {
		echo("Error adding member to the database.");
	}

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

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

if ($page == "addresses" and $request == "view_member_billing_address" and $members_id) {
	echo("<b>Addresses - View Billing Address</b><p>");
	
	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);
	
	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
	$db_members_billing_addresses_first_name = $db_members_billing_addresses['first_name'];
	$db_members_billing_addresses_last_name = $db_members_billing_addresses['last_name'];
	$db_members_billing_addresses_email_address = $db_members_billing_addresses['email_address'];
	$db_members_billing_addresses_company_name = $db_members_billing_addresses['company_name'];
	$db_members_billing_addresses_address = $db_members_billing_addresses['address'];
	$db_members_billing_addresses_address_2 = $db_members_billing_addresses['address_2'];
	$db_members_billing_addresses_city = $db_members_billing_addresses['city'];
	$db_members_billing_addresses_state = $db_members_billing_addresses['state'];
	$db_members_billing_addresses_zip_code = $db_members_billing_addresses['zip_code'];
	$db_members_billing_addresses_phone_1 = $db_members_billing_addresses['phone_1'];
	$db_members_billing_addresses_phone_2 = $db_members_billing_addresses['phone_2'];
	$db_members_billing_addresses_phone_3 = $db_members_billing_addresses['phone_3'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_first_name . " " . $db_members_billing_addresses_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_company_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</td>");
	echo("<td>");
	echo($font_body . $db_members_billing_addresses_address . "</font>");
	if ($db_members_billing_addresses_address_2) {
		echo($font_body . "<br>$db_members_billing_addresses_address_2");
	}
	echo($font_body . "<br>" . $db_members_billing_addresses_city . ", " . $db_members_billing_addresses_state . "&nbsp;" . $db_members_billing_addresses_zip_code);
	echo("</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_1 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_2 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_3 . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");

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

}

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

if ($page == "addresses" and $request == "edit_member_billing_address" and $members_id) {
	echo("<b>Addresses - Edit Billing Address</b><p>");

	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);
	
	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
	$db_members_billing_addresses_first_name = $db_members_billing_addresses['first_name'];
	$db_members_billing_addresses_last_name = $db_members_billing_addresses['last_name'];
	$db_members_billing_addresses_email_address = $db_members_billing_addresses['email_address'];
	$db_members_billing_addresses_company_name = $db_members_billing_addresses['company_name'];
	$db_members_billing_addresses_address = $db_members_billing_addresses['address'];
	$db_members_billing_addresses_address_2 = $db_members_billing_addresses['address_2'];
	$db_members_billing_addresses_city = $db_members_billing_addresses['city'];
	$db_members_billing_addresses_state = $db_members_billing_addresses['state'];
	$db_members_billing_addresses_zip_code = $db_members_billing_addresses['zip_code'];
	$db_members_billing_addresses_phone_1 = $db_members_billing_addresses['phone_1'];
	$db_members_billing_addresses_phone_2 = $db_members_billing_addresses['phone_2'];
	$db_members_billing_addresses_phone_3 = $db_members_billing_addresses['phone_3'];
		
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=edit_member_billing_address_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$db_members_billing_addresses_members_id'>");
	echo("<input type='hidden' name='members_billing_addresses_id' value='$members_billing_addresses_id'>");	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name' value='$db_members_billing_addresses_first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name' value='$db_members_billing_addresses_last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address' value='$db_members_billing_addresses_email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='company_name' value='$db_members_billing_addresses_company_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</font></td>");
	echo("<td>" . $font_body . "<table border='0' cellpadding='0' cellspacing='0'><tr><td>" . $font_body . "Address:</td><td><input type='text' name='address' value='$db_members_billing_addresses_address'></td></tr><tr><td>" . $font_body . "Address 2: </td><td><input type='text' name='address_2' value='$db_members_billing_addresses_address_2'></td></tr><tr><td>" . $font_body . "City:</td><td><input type='text' name='city' value='$db_members_billing_addresses_city'></td></tr><tr><td>" . $font_body . "State:</td><td><input type='text' name='state' value='$db_members_billing_addresses_state'></td></tr><tr><td>" . $font_body . "Zip code:</td><td><input type='text' name='zip_code' value='$db_members_billing_addresses_zip_code'></td></tr></font></table>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_1' value='$db_members_billing_addresses_phone_1'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_2' value='$db_members_billing_addresses_phone_2'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_3' value='$db_members_billing_addresses_phone_3'></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=addresses'>" . $link_color . "Addresses</font></a>]");
}

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

if ($page == "addresses" and $request == "edit_member_billing_address_submit" and $members_id) {
	echo("<b>Addresses - Edit Billing Address</b><p>");
	
	$members_id = $_POST['members_id'];
	$members_billing_addresses_id = $_POST['members_billing_addresses_id'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$company_name = $_POST['company_name'];
	$address = $_POST['address'];
	$address_2 = $_POST['address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip_code = $_POST['zip_code'];
	$phone_1 = $_POST['phone_1'];
	$phone_2 = $_POST['phone_2'];
	$phone_3 = $_POST['phone_3'];
	
	$dbinsert = "UPDATE members_billing_addresses SET " . 
		"first_name = '$first_name', " .  
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " .  
		"company_name = '$company_name', " . 
		"address = '$address', " . 
		"address_2 = '$address_2', " . 
		"city = '$city', " . 
		"state = '$state', " . 
		"zip_code = '$zip_code', " . 
		"phone_1 = '$phone_1', " . 
		"phone_2 = '$phone_2', " . 
		"phone_3 = '$phone_3'" . 
		"WHERE id = '$members_billing_addresses_id'";
	
	if (@mysql_query($dbinsert)) {
		echo("Member billing address has been updated.");
	} else {
		echo("Error updating member billing address.");
	}

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

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

if ($page == "addresses" and $request == "delete_member_billing_address" and $members_id) {
	echo("<b>Addresses - Delete Billing Address</b><p>");
	
	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);
	
	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
	$db_members_billing_addresses_first_name = $db_members_billing_addresses['first_name'];
	$db_members_billing_addresses_last_name = $db_members_billing_addresses['last_name'];
	$db_members_billing_addresses_email_address = $db_members_billing_addresses['email_address'];
	$db_members_billing_addresses_company_name = $db_members_billing_addresses['company_name'];
	$db_members_billing_addresses_address = $db_members_billing_addresses['address'];
	$db_members_billing_addresses_address_2 = $db_members_billing_addresses['address_2'];
	$db_members_billing_addresses_city = $db_members_billing_addresses['city'];
	$db_members_billing_addresses_state = $db_members_billing_addresses['state'];
	$db_members_billing_addresses_zip_code = $db_members_billing_addresses['zip_code'];
	$db_members_billing_addresses_phone_1 = $db_members_billing_addresses['phone_1'];
	$db_members_billing_addresses_phone_2 = $db_members_billing_addresses['phone_2'];
	$db_members_billing_addresses_phone_3 = $db_members_billing_addresses['phone_3'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_first_name . " " . $db_members_billing_addresses_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_company_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</td>");
	echo("<td>");
	echo($font_body . $db_members_billing_addresses_address . "</font>");
	if ($db_members_billing_addresses_address_2) {
		echo($font_body . "<br>$db_members_billing_addresses_address_2");
	}
	echo($font_body . "<br>" . $db_members_billing_addresses_city . ", " . $db_members_billing_addresses_state . "&nbsp;" . $db_members_billing_addresses_zip_code);
	echo("</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_1 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_2 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</td>");
	echo("<td>" . $font_body . $db_members_billing_addresses_phone_3 . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");
		
	echo("Are you sure you want to delete this member billing address?<p>");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=delete_member_billing_address_submit&members_billing_addresses_id=$members_billing_addresses_id'>" . $link_color . "Yes</font></a>]&nbsp;");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=delete_member_billing_address_cancel&members_billing_addresses_id=$members_billing_addresses_id'>" . $link_color . "No</font></a>]");

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

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

if ($page == "addresses" and $request == "delete_member_billing_address_submit" and $members_id) {
	echo("<b>Addresses - Delete Billing Address</b><p>");
	
	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT id, members_id FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);

	$db_members_billing_addresses_id = $db_members_billing_addresses['id'];
	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];
	
	$db_delete_members_billing_addresses = @mysql_query("DELETE FROM members_billing_addresses WHERE id='$db_members_billing_addresses_id'");

	if ($db_delete_members_billing_addresses) {
		echo("The member billing address been deleted.");
	} else {
		echo("Error deleting member billing address.");
	}

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

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

if ($page == "addresses" and $request == "delete_member_billing_address_cancel" and $members_id) {
	echo("<b>Addresses - Delete Billing Address</b><p>");

	$members_billing_addresses_id = $_GET['members_billing_addresses_id'];

	$db_lookup_members_billing_addresses = @mysql_query("SELECT members_id FROM members_billing_addresses WHERE id='$members_billing_addresses_id'");
	$db_members_billing_addresses = @mysql_fetch_array($db_lookup_members_billing_addresses);

	$db_members_billing_addresses_members_id = $db_members_billing_addresses['members_id'];

	echo("The member billing address has not been deleted from the database.");

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

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

if ($page == "addresses" and $request == "new_shipping_address" and $members_id) {
	echo("<b>Addresses - New Shipping Address</b><p>");

	$members_id = $_GET['members_id'];

	echo("member id: $members_id");

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=new_shipping_address_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$members_id'>");
	echo("<input type='hidden' name='date' value='" . $date . "'>");
	echo("<input type='hidden' name='time' value='" . $time . "'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='company_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</font></td>");
	echo("<td>" . $font_body . "<table border='0' cellpadding='0' cellspacing='0'><tr><td>" . $font_body . "Address:</td><td><input type='text' name='address'></td></tr><tr><td>" . $font_body . "Address 2: </td><td><input type='text' name='address_2'></td></tr><tr><td>" . $font_body . "City:</td><td><input type='text' name='city'></td></tr><tr><td>" . $font_body . "State:</td><td><input type='text' name='state'></td></tr><tr><td>" . $font_body . "Zip code:</td><td><input type='text' name='zip_code'></td></tr></font></table>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_1'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_2'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_3'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Submit'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");
	
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses'>" . $link_color . "Addresses</font></a>]");
}

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

if ($page == "addresses" and $request == "new_shipping_address_submit" and $members_id) {
	echo("<b>Addresses - New Shipping Address</b><p>");

	$members_id = $_POST['members_id'];
	$date = $_POST['date'];
	$time = $_POST['time'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$company_name = $_POST['company_name'];
	$address = $_POST['address'];
	$address_2 = $_POST['address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip_code = $_POST['zip_code'];
	$phone_1 = $_POST['phone_1'];
	$phone_2 = $_POST['phone_2'];
	$phone_3 = $_POST['phone_3'];
	
	$dbinsert = "INSERT INTO members_shipping_addresses SET " . 
		"members_id = '$members_id', " .  
		"date = '$date', " .  
		"time = '$time', " . 
		"first_name = '$first_name', " . 
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " . 
		"company_name = '$company_name', " . 
		"address = '$address', " . 
		"address_2 = '$address_2', " . 
		"city = '$city', " . 
		"state = '$state', " . 
		"zip_code = '$zip_code', " . 
		"phone_1 = '$phone_1', " . 
		"phone_2 = '$phone_2', " . 
		"phone_3 = '$phone_3'";
	
	if (@mysql_query($dbinsert)) {
		echo("The address has been added to the database.");
	} else {
		echo("Error adding member to the database.");
	}

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

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

if ($page == "addresses" and $request == "view_member_shipping_address" and $members_id) {
	echo("<b>Addresses - View Shipping Address</b><p>");
	
	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);
	
	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
	$db_members_shipping_addresses_first_name = $db_members_shipping_addresses['first_name'];
	$db_members_shipping_addresses_last_name = $db_members_shipping_addresses['last_name'];
	$db_members_shipping_addresses_email_address = $db_members_shipping_addresses['email_address'];
	$db_members_shipping_addresses_company_name = $db_members_shipping_addresses['company_name'];
	$db_members_shipping_addresses_address = $db_members_shipping_addresses['address'];
	$db_members_shipping_addresses_address_2 = $db_members_shipping_addresses['address_2'];
	$db_members_shipping_addresses_city = $db_members_shipping_addresses['city'];
	$db_members_shipping_addresses_state = $db_members_shipping_addresses['state'];
	$db_members_shipping_addresses_zip_code = $db_members_shipping_addresses['zip_code'];
	$db_members_shipping_addresses_phone_1 = $db_members_shipping_addresses['phone_1'];
	$db_members_shipping_addresses_phone_2 = $db_members_shipping_addresses['phone_2'];
	$db_members_shipping_addresses_phone_3 = $db_members_shipping_addresses['phone_3'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_first_name . " " . $db_members_shipping_addresses_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_company_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</td>");
	echo("<td>");
	echo($font_body . $db_members_shipping_addresses_address . "</font>");
	if ($db_members_shipping_addresses_address_2) {
		echo($font_body . "<br>$db_members_shipping_addresses_address_2");
	}
	echo($font_body . "<br>" . $db_members_shipping_addresses_city . ", " . $db_members_shipping_addresses_state . "&nbsp;" . $db_members_shipping_addresses_zip_code);
	echo("</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_1 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_2 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_3 . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");

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

}

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

if ($page == "addresses" and $request == "edit_member_shipping_address" and $members_id) {
	echo("<b>Addresses - Edit Shipping Address</b><p>");

	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);
	
	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
	$db_members_shipping_addresses_first_name = $db_members_shipping_addresses['first_name'];
	$db_members_shipping_addresses_last_name = $db_members_shipping_addresses['last_name'];
	$db_members_shipping_addresses_email_address = $db_members_shipping_addresses['email_address'];
	$db_members_shipping_addresses_company_name = $db_members_shipping_addresses['company_name'];
	$db_members_shipping_addresses_address = $db_members_shipping_addresses['address'];
	$db_members_shipping_addresses_address_2 = $db_members_shipping_addresses['address_2'];
	$db_members_shipping_addresses_city = $db_members_shipping_addresses['city'];
	$db_members_shipping_addresses_state = $db_members_shipping_addresses['state'];
	$db_members_shipping_addresses_zip_code = $db_members_shipping_addresses['zip_code'];
	$db_members_shipping_addresses_phone_1 = $db_members_shipping_addresses['phone_1'];
	$db_members_shipping_addresses_phone_2 = $db_members_shipping_addresses['phone_2'];
	$db_members_shipping_addresses_phone_3 = $db_members_shipping_addresses['phone_3'];
		
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=edit_member_shipping_address_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$db_members_shipping_addresses_members_id'>");
	echo("<input type='hidden' name='members_shipping_addresses_id' value='$members_shipping_addresses_id'>");	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name' value='$db_members_shipping_addresses_first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name' value='$db_members_shipping_addresses_last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address' value='$db_members_shipping_addresses_email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='company_name' value='$db_members_shipping_addresses_company_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</font></td>");
	echo("<td>" . $font_body . "<table border='0' cellpadding='0' cellspacing='0'><tr><td>" . $font_body . "Address:</td><td><input type='text' name='address' value='$db_members_shipping_addresses_address'></td></tr><tr><td>" . $font_body . "Address 2: </td><td><input type='text' name='address_2' value='$db_members_shipping_addresses_address_2'></td></tr><tr><td>" . $font_body . "City:</td><td><input type='text' name='city' value='$db_members_shipping_addresses_city'></td></tr><tr><td>" . $font_body . "State:</td><td><input type='text' name='state' value='$db_members_shipping_addresses_state'></td></tr><tr><td>" . $font_body . "Zip code:</td><td><input type='text' name='zip_code' value='$db_members_shipping_addresses_zip_code'></td></tr></font></table>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_1' value='$db_members_shipping_addresses_phone_1'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_2' value='$db_members_shipping_addresses_phone_2'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='phone_3' value='$db_members_shipping_addresses_phone_3'></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=addresses'>" . $link_color . "Addresses</font></a>]");
}

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

if ($page == "addresses" and $request == "edit_member_shipping_address_submit" and $members_id) {
	echo("<b>Addresses - Edit Shipping Address</b><p>");
	
	$members_id = $_POST['members_id'];
	$members_shipping_addresses_id = $_POST['members_shipping_addresses_id'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$company_name = $_POST['company_name'];
	$address = $_POST['address'];
	$address_2 = $_POST['address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip_code = $_POST['zip_code'];
	$phone_1 = $_POST['phone_1'];
	$phone_2 = $_POST['phone_2'];
	$phone_3 = $_POST['phone_3'];
	
	$dbinsert = "UPDATE members_shipping_addresses SET " . 
		"first_name = '$first_name', " .  
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " .  
		"company_name = '$company_name', " . 
		"address = '$address', " . 
		"address_2 = '$address_2', " . 
		"city = '$city', " . 
		"state = '$state', " . 
		"zip_code = '$zip_code', " . 
		"phone_1 = '$phone_1', " . 
		"phone_2 = '$phone_2', " . 
		"phone_3 = '$phone_3'" . 
		"WHERE id = '$members_shipping_addresses_id'";
	
	if (@mysql_query($dbinsert)) {
		echo("Member shipping address has been updated.");
	} else {
		echo("Error updating member shipping address.");
	}

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

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

if ($page == "addresses" and $request == "delete_member_shipping_address" and $members_id) {
	echo("<b>Addresses - Delete Shipping Address</b><p>");
	
	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id, date, time, first_name, last_name, email_address, company_name, address, address_2, city, state, zip_code, phone_1, phone_2, phone_3 FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);
	
	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
	$db_members_shipping_addresses_first_name = $db_members_shipping_addresses['first_name'];
	$db_members_shipping_addresses_last_name = $db_members_shipping_addresses['last_name'];
	$db_members_shipping_addresses_email_address = $db_members_shipping_addresses['email_address'];
	$db_members_shipping_addresses_company_name = $db_members_shipping_addresses['company_name'];
	$db_members_shipping_addresses_address = $db_members_shipping_addresses['address'];
	$db_members_shipping_addresses_address_2 = $db_members_shipping_addresses['address_2'];
	$db_members_shipping_addresses_city = $db_members_shipping_addresses['city'];
	$db_members_shipping_addresses_state = $db_members_shipping_addresses['state'];
	$db_members_shipping_addresses_zip_code = $db_members_shipping_addresses['zip_code'];
	$db_members_shipping_addresses_phone_1 = $db_members_shipping_addresses['phone_1'];
	$db_members_shipping_addresses_phone_2 = $db_members_shipping_addresses['phone_2'];
	$db_members_shipping_addresses_phone_3 = $db_members_shipping_addresses['phone_3'];
	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Name:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_first_name . " " . $db_members_shipping_addresses_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Company:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_company_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Address:</td>");
	echo("<td>");
	echo($font_body . $db_members_shipping_addresses_address . "</font>");
	if ($db_members_shipping_addresses_address_2) {
		echo($font_body . "<br>$db_members_shipping_addresses_address_2");
	}
	echo($font_body . "<br>" . $db_members_shipping_addresses_city . ", " . $db_members_shipping_addresses_state . "&nbsp;" . $db_members_shipping_addresses_zip_code);
	echo("</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 1:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_1 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 2:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_2 . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Phone 3:</td>");
	echo("<td>" . $font_body . $db_members_shipping_addresses_phone_3 . "</td>");
	echo("</tr>");
	echo("</table>");
	echo("<p>");
		
	echo("Are you sure you want to delete this member shipping address?<p>");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=delete_member_shipping_address_submit&members_shipping_addresses_id=$members_shipping_addresses_id'>" . $link_color . "Yes</font></a>]&nbsp;");
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=addresses&request=delete_member_shipping_address_cancel&members_shipping_addresses_id=$members_shipping_addresses_id'>" . $link_color . "No</font></a>]");

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

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

if ($page == "addresses" and $request == "delete_member_shipping_address_submit" and $members_id) {
	echo("<b>Addresses - Delete Shipping Address</b><p>");
	
	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT id, members_id FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);

	$db_members_shipping_addresses_id = $db_members_shipping_addresses['id'];
	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];
	
	$db_delete_members_shipping_addresses = @mysql_query("DELETE FROM members_shipping_addresses WHERE id='$db_members_shipping_addresses_id'");

	if ($db_delete_members_shipping_addresses) {
		echo("The member shipping address been deleted.");
	} else {
		echo("Error deleting member shipping address.");
	}

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

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

if ($page == "addresses" and $request == "delete_member_shipping_address_cancel" and $members_id) {
	echo("<b>Addresses - Delete Shipping Address</b><p>");

	$members_shipping_addresses_id = $_GET['members_shipping_addresses_id'];

	$db_lookup_members_shipping_addresses = @mysql_query("SELECT members_id FROM members_shipping_addresses WHERE id='$members_shipping_addresses_id'");
	$db_members_shipping_addresses = @mysql_fetch_array($db_lookup_members_shipping_addresses);

	$db_members_shipping_addresses_members_id = $db_members_shipping_addresses['members_id'];

	echo("The member shipping address has not been deleted from the database.");

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

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

if ($page == "profile" and !$request and $members_id) {

	echo("<b>Profile</b><p>");

	$db_lookup_members = @mysql_query("SELECT id, first_name, last_name, email_address, password FROM members WHERE email_address='$members_email_address'");
	$db_members = @mysql_fetch_array($db_lookup_members);
	
	$db_members_id = $db_members['id'];
	$db_members_first_name = $db_members['first_name'];
	$db_members_last_name = $db_members['last_name'];
	$db_members_email_address = $db_members['email_address'];
	$db_members_password = $db_members['password'];

	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "<b>Name:</b></td>");
	echo("<td>" . $font_body . $db_members_first_name . " " . $db_members_last_name . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "<b>Email Address:</b></td>");
	echo("<td>" . $font_body . "" . $db_members_email_address . "</td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "<b>Password:</b></td>");
	echo("<td>" . $font_body . "**********<br></td>");
	echo("</tr>");
	echo("</table>");

	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=profile&request=edit_profile'>" . $link_color . "Edit</font></a>]");
}

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

if ($page == "profile" and $request == "edit_profile" and $members_id) {

	echo("<b>Profile - Edit Profile</b><p>");

	$db_lookup_members = @mysql_query("SELECT id, first_name, last_name, email_address FROM members WHERE email_address='$members_email_address'");
	$db_members = @mysql_fetch_array($db_lookup_members);
	
	$db_members_id = $db_members['id'];
	$db_members_first_name = $db_members['first_name'];
	$db_members_last_name = $db_members['last_name'];
	$db_members_email_address = $db_members['email_address'];
	$db_members_password = $db_members['password'];

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=profile&request=edit_profile_submit' method='post'>");
	echo("<input type='hidden' name='members_id' value='$db_members_id'>");	
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "First Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='first_name' value='$db_members_first_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Last Name:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='last_name' value='$db_members_last_name'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Email Address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address' value='$db_members_email_address'></font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "Password:</font></td>");
	echo("<td>" . $font_body . "<input type='password' name='password' value='$db_members_password'></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=profile'>" . $link_color . "Profile</font></a>]");
}

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

if ($page == "profile" and $request == "edit_profile_submit" and $members_id) {
	echo("<b>Profile - Edit Profile</b><p>");

	$members_id = $_POST['members_id'];
	$first_name = $_POST['first_name'];
	$last_name = $_POST['last_name'];
	$email_address = $_POST['email_address'];
	$password = $_POST['password'];
		
	$db_update_members = "UPDATE members SET " . 
		"first_name = '$first_name', " .  
		"last_name = '$last_name', " . 
		"email_address = '$email_address', " . 
		"password = '$password' " . 
		"WHERE id = '$members_id'";
	
	if (@mysql_query($db_update_members)) {
		echo("Profile has been updated.");
	} else {
		echo("Error updating profile.");
	}
	echo("<p>[<a href='" . $_SERVER['PHP_SELF'] . "?page=profile'>" . $link_color . "Profile</font></a>]");
}

?>
Return current item: FreePHPShoppingCartSoftware