Location: PHPKode > projects > Free Simple Shop > admin_settings.inc
<?php

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

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

if ($request == "install" and $admin_rights == "Admin") {
	echo("<b>Settings - Install Module</b><p>");
		
	$db_lookup_admin_settings = @mysql_query("SELECT id FROM admin_settings");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	if ($db_admin_settings) {
		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 - DC - Version 1.0
// =======================================================================

if ($request == "run_install" and $admin_rights == "Admin") {
	
	if ($install_type != "express") {
		echo("<b>Settings - Install Module</b><p>");
	}

	$db_create_admin_settings = "CREATE TABLE admin_settings (" . 
		"id int not null auto_increment primary key, " . 
		"setting_type text, " . 
		"setting text" .
		")";

	if ($time_zone) {
		$db_insert_admin_settings_time_zone = "INSERT INTO admin_settings SET " . 
			"setting_type = 'time_zone', " . 
			"setting = '$time_zone'";
	}

	if ($dst) {
		$db_insert_admin_settings_dst = "INSERT INTO admin_settings SET " . 
			"setting_type = 'dst', " . 
			"setting = '$dst'";
	}
	if ($google_analytics_id) {
		$db_insert_admin_settings_google_analytics_id = "INSERT INTO admin_settings SET " . 
			"setting_type = 'google_analytics_id', " . 
			"setting = '$google_analytics_id'";
	}
	if ($default_email) {
		$db_insert_admin_settings_default_email = "INSERT INTO admin_settings SET " . 
			"setting_type = 'default_email', " . 
			"setting = '$default_email'";
	}

	if ($install_type != "express") {
		echo("Admin Settings Installation Status:<p>");
		echo("<table border='0' cellpadding='5' cellspacing='0'>");
	}
	echo("<tr>");
	echo("<td>" . $font_body . "Admin Settings Table Setup</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_create_admin_settings)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	if ($time_zone) {
		echo("<tr>");
		echo("<td>" . $font_body . "Insert Admin Settings Time Zone</td>");
		echo("<td>" . $font_body . "");
		if (@mysql_query($db_insert_admin_settings_time_zone)) {
			echo("Successful");
		} else {
			echo("Error");
		}
		echo("</font></td>");
		echo("</tr>");
	}
	if ($dst) {
		echo("<tr>");
		echo("<td>" . $font_body . "Insert Admin Settings DST</td>");
		echo("<td>" . $font_body . "");
		if (@mysql_query($db_insert_admin_settings_dst)) {
			echo("Successful");
		} else {
			echo("Error");
		}
		echo("</font></td>");
		echo("</tr>");
	}
	if ($google_analytics_id) {
		echo("<tr>");
		echo("<td>" . $font_body . "Insert Admin Settings Google Analytics ID</td>");
		echo("<td>" . $font_body . "");
		if (@mysql_query($db_insert_admin_settings_google_analytics_id)) {
			echo("Successful");
		} else {
			echo("Error");
		}
		echo("</font></td>");
		echo("</tr>");
	}
	if ($default_email) {
		echo("<tr>");
		echo("<td>" . $font_body . "Insert Admin Settings Default Email</td>");
		echo("<td>" . $font_body . "");
		if (@mysql_query($db_insert_admin_settings_default_email)) {
			echo("Successful");
		} else {
			echo("Error");
		}
		echo("</font></td>");
		echo("</tr>");
	}

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

	$db_insert_admin_menu_settings = "INSERT INTO admin_menu SET " . 
		"menu_categories_id = '$db_admin_menu_categories_id', " . 
		"name = 'Settings', " . 
		"include_file = 'admin_settings.inc', " . 
		"page = 'settings'";

	echo("<tr>");
	echo("<td>" . $font_body . "Insert Admin Menu Settings</td>");
	echo("<td>" . $font_body . "");
	if (@mysql_query($db_insert_admin_menu_settings)) {
		echo("Successful");
	} else {
		echo("Error");
	}
	echo("</font></td>");
	echo("</tr>");
	if ($install_type != "express") {
		echo("</table>");
		echo("<p>");
	}
}

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

if ($page == "settings" and !$request and $admin_rights == "Admin") {

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

	$db_lookup_admin_settings = @mysql_query("SELECT id, setting FROM admin_settings WHERE setting_type='default_email'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_id = $db_admin_settings['id'];
	$db_admin_settings_setting = $db_admin_settings['setting'];

	echo($font_body . "<b>Default Email Address Settings</b></font><p>");

	if ($db_admin_settings_setting) {

		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "Email Address</font></td>");
		echo("<td>" . $font_body . "Actions</font></td>");
		echo("</tr>");
		echo("<tr>");
		echo("<td>" . $font_body . $db_admin_settings_setting . "</font></td>");
		echo("<td>" . $font_body . "[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings&request=edit_default_email&admin_settings_id=$db_admin_settings_id'>" . $link_color . "Edit</font></a>]</td>");
		echo("</tr>");
		echo("</table>");
		echo("<p>");
	} else {
		echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings&request=new_default_email'>" . $link_color . "New</font></a>]<p>");
	}

	$db_lookup_admin_settings = @mysql_query("SELECT id, setting FROM admin_settings WHERE setting_type='google_analytics_id'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_id = $db_admin_settings['id'];
	$db_admin_settings_setting = $db_admin_settings['setting'];

	echo($font_body . "<b>Google Analytics Settings</b></font><p>");

	if ($db_admin_settings_setting) {

		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "Account ID</font></td>");
		echo("<td>" . $font_body . "Actions</font></td>");
		echo("</tr>");
		echo("<tr>");
		echo("<td>" . $font_body . $db_admin_settings_setting . "</font></td>");
		echo("<td>" . $font_body . "[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings&request=edit_google_analytics&admin_settings_id=$db_admin_settings_id'>" . $link_color . "Edit</font></a>]</td>");
		echo("</tr>");
		echo("</table>");
		echo("<p>");
	} else {
		echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings&request=new_google_analytics'>" . $link_color . "New</font></a>]<p>");
	}
	
	$db_lookup_admin_settings = @mysql_query("SELECT id, setting FROM admin_settings WHERE setting_type='time_zone'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_id = $db_admin_settings['id'];
	$db_admin_settings_setting = $db_admin_settings['setting'];

	echo($font_body . "<b>Time Zone Settings</b></font><p>");

	if ($db_admin_settings_setting) {

		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "Time Zone</font></td>");
		echo("<td>" . $font_body . "Actions</font></td>");
		echo("</tr>");
		echo("<tr>");
		echo("<td>" . $font_body . $db_admin_settings_setting . "</font></td>");
		echo("<td>" . $font_body . "[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings&request=edit_time_zone&admin_settings_id=$db_admin_settings_id'>" . $link_color . "Edit</font></a>]</td>");
		echo("</tr>");
		echo("</table>");
		echo("<p>");
	} else {
		echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings&request=new_time_zone'>" . $link_color . "New</font></a>]<p>");
	}

	$db_lookup_admin_settings = @mysql_query("SELECT id, setting FROM admin_settings WHERE setting_type='dst'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_id = $db_admin_settings['id'];
	$db_admin_settings_setting = $db_admin_settings['setting'];

	echo($font_body . "<b>Daylight Savings Settings</b></font><p>");

	if ($db_admin_settings_setting) {

		echo("<table border='0' cellpadding='5' cellspacing='0'>");
		echo("<tr>");
		echo("<td>" . $font_body . "DST</font></td>");
		echo("<td>" . $font_body . "Actions</font></td>");
		echo("</tr>");
		echo("<tr>");
		echo("<td>" . $font_body . $db_admin_settings_setting . "</font></td>");
		echo("<td>" . $font_body . "[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings&request=edit_dst&admin_settings_id=$db_admin_settings_id'>" . $link_color . "Edit</font></a>]</td>");
		echo("</tr>");
		echo("</table>");

		echo "<p>Current Date & Time: $date $time<p>";

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

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

if ($page == "settings" and $request == "new_default_email" and $admin_rights == "Admin") {

	echo("<b>Settings - New Default Email Address</b><p>");

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=settings&request=new_default_email_submit' method='post'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Default email address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address'></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>");
	
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings'>" . $link_color . "Settings</font></a>]<p>");
}

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

if ($page == "settings" and $request == "new_default_email_submit" and $admin_rights == "Admin") {

	echo("<b>Settings - New Default Email Address</b><p>");

	$email_address = $_POST['email_address'];

	$db_lookup_admin_settings = @mysql_query("SELECT setting FROM admin_settings WHERE setting_type='default_email'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_setting = $db_admin_settings['setting'];

	if (!$db_admin_settings_setting) {
	
		$db_insert_admin_settings = "INSERT INTO admin_settings SET " . 
			"setting_type = 'default_email', " .  
			"setting = '$email_address'";
		
		if (@mysql_query($db_insert_admin_settings)) {
			echo("Default email address created successfully.");
		} else {
			echo("Error creating default email address.");
		}
	} else {
		echo("Default email address already exists.");
	}

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

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

if ($page == "settings" and $request == "edit_default_email" and $admin_rights == "Admin") {

	echo("<b>Settings - Edit Default Email Address</b><p>");

	$admin_settings_id = $_GET['admin_settings_id'];

	$db_lookup_admin_settings = @mysql_query("SELECT id, setting FROM admin_settings WHERE id='$admin_settings_id'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_id = $db_admin_settings['id'];
	$db_admin_settings_setting = $db_admin_settings['setting'];
	
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=settings&request=edit_default_email_submit' method='post'>");
	echo("<input type='hidden' name='admin_settings_id' value='$db_admin_settings_id'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Default email address:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='email_address' value='$db_admin_settings_setting'></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=settings'>" . $link_color . "Settings</font></a>]");
}

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

if ($page == "settings" and $request =="edit_default_email_submit" and $admin_rights == "Admin") {

	echo("<b>Settings - Edit Default Email Address</b><p>");

	$admin_settings_id = $_POST['admin_settings_id'];
	$email_address = $_POST['email_address'];
	
	$db_update_admin_settings = "UPDATE admin_settings SET " . 
		"setting = '$email_address'" .  
		"WHERE id = '$admin_settings_id'";
	
	if (@mysql_query($db_update_admin_settings)) {
		echo("Default email address updated successfully.");
	} else {
		echo("Default email address update error.");
	}

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

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

if ($page == "settings" and $request == "new_google_analytics" and $admin_rights == "Admin") {

	echo("<b>Settings - New Google Analytics Settings</b><p>");

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=settings&request=new_google_analytics_submit' method='post'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Account ID:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='google_analytics_id'><br>(Example: UA-XXXXXXX-X)</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>");
	
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings'>" . $link_color . "Settings</font></a>]<p>");
}

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

if ($page == "settings" and $request == "new_google_analytics_submit" and $admin_rights == "Admin") {

	echo("<b>Settings - New Google Analytics Settings</b><p>");

	$google_analytics_id = $_POST['google_analytics_id'];

	$db_lookup_admin_settings = @mysql_query("SELECT setting FROM admin_settings WHERE google_analytics_id='$google_analytics_id'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_setting = $db_admin_settings['setting'];

	if (!$db_admin_settings_setting) {
	
		$db_insert_admin_settings = "INSERT INTO admin_settings SET " . 
			"setting_type = 'google_analytics_id', " .  
			"setting = '$google_analytics_id'";
		
		if (@mysql_query($db_insert_admin_settings)) {
			echo("Google Analytics settings created successfully.");
		} else {
			echo("Error creating Google Analytics settings.");
		}
	} else {
		echo("Google Analytics settings already exists.");
	}

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

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

if ($page == "settings" and $request == "edit_google_analytics" and $admin_rights == "Admin") {

	echo("<b>Settings - Edit Google Analytics Settings</b><p>");

	$admin_settings_id = $_GET['admin_settings_id'];

	$db_lookup_admin_settings = @mysql_query("SELECT id, setting FROM admin_settings WHERE id='$admin_settings_id'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_id = $db_admin_settings['id'];
	$db_admin_settings_setting = $db_admin_settings['setting'];
	
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=settings&request=edit_google_analytics_submit' method='post'>");
	echo("<input type='hidden' name='admin_settings_id' value='$db_admin_settings_id'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Account ID:</font></td>");
	echo("<td>" . $font_body . "<input type='text' name='google_analytics_id' value='$db_admin_settings_setting'><br>(Example: UA-XXXXXXX-X)</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=settings'>" . $link_color . "Settings</font></a>]");
}

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

if ($page == "settings" and $request =="edit_google_analytics_submit" and $admin_rights == "Admin") {

	echo("<b>Settings - Edit Google Analytics Settings</b><p>");

	$admin_settings_id = $_POST['admin_settings_id'];
	$google_analytics_id = $_POST['google_analytics_id'];
	
	$db_update_admin_settings = "UPDATE admin_settings SET " . 
		"setting = '$google_analytics_id'" .  
		"WHERE id = '$admin_settings_id'";
	
	if (@mysql_query($db_update_admin_settings)) {
		echo("Google Analytics settings updated successfully.");
	} else {
		echo("Google Analytics settings update error.");
	}

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

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

if ($page == "settings" and $request == "new_time_zone" and $admin_rights == "Admin") {

	echo("<b>Settings - New Time Zone</b><p>");

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=settings&request=new_time_zone_submit' method='post'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Time Zone:</font></td>");
	echo("<td>" . $font_body . "");
	echo("<select size='1' name='time_zone'>");
	echo("<option value='-12'>UTC-12</option>");
	echo("<option value='-11'>UTC-11</option>");
	echo("<option value='-10'>UTC-10</option>");
	echo("<option value='-9.5'>UTC-9:30</option>");
	echo("<option value='-9'>UTC-9</option>");
	echo("<option value='-8'>UTC-8</option>");
	echo("<option value='-7'>UTC-7</option>");
	echo("<option value='-6'>UTC-6</option>");
	echo("<option value='-5'>UTC-5</option>");
	echo("<option value='-4.5'>UTC-4:30</option>");
	echo("<option value='-4'>UTC-4</option>");
	echo("<option value='-3.5'>UTC-3:30</option>");
	echo("<option value='-3'>UTC-3</option>");
	echo("<option value='-2'>UTC-2</option>");
	echo("<option value='-1'>UTC-1</option>");
	echo("<option value='0' selected>UTC</option>");
	echo("<option value='+1'>UTC+1</option>");
	echo("<option value='+2'>UTC+2</option>");
	echo("<option value='+3'>UTC+3</option>");
	echo("<option value='+3.5'>UTC+3:30</option>");
	echo("<option value='+4'>UTC+4</option>");
	echo("<option value='+4.5'>UTC+4:30</option>");
	echo("<option value='+5'>UTC+5</option>");
	echo("<option value='+5.5'>UTC+5:30</option>");
	echo("<option value='+5.75'>UTC+5:45</option>");
	echo("<option value='+6'>UTC+6</option>");
	echo("<option value='+6.5'>UTC+6:30</option>");
	echo("<option value='+7'>UTC+7</option>");
	echo("<option value='+8'>UTC+8</option>");
	echo("<option value='+8.75'>UTC+8:45</option>");
	echo("<option value='+9'>UTC+9</option>");
	echo("<option value='+9.5'>UTC+9:30</option>");
	echo("<option value='+10'>UTC+10</option>");
	echo("<option value='+10.5'>UTC+10:30</option>");
	echo("<option value='+11'>UTC+11</option>");
	echo("<option value='+11.5'>UTC+11:30</option>");
	echo("<option value='+12'>UTC+12</option>");
	echo("<option value='+12.75'>UTC+12:45</option>");
	echo("<option value='+13'>UTC+13</option>");
	echo("<option value='+14'>UTC+14</option>");
	echo("</select>");
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Submit'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");
	echo("<p>");
	
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings'>" . $link_color . "Settings</font></a>]<p>");
}

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

if ($page == "settings" and $request == "new_time_zone_submit" and $admin_rights == "Admin") {

	echo("<b>Settings - New Time Zone</b><p>");

	$time_zone = $_POST['time_zone'];

	$db_lookup_admin_settings = @mysql_query("SELECT setting FROM admin_settings WHERE setting_type='time_zone'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_setting = $db_admin_settings['setting'];

	if (!$db_admin_settings_setting) {
	
		$db_insert_admin_settings = "INSERT INTO admin_settings SET " . 
			"setting_type = 'time_zone', " .  
			"setting = '$time_zone'";
		
		if (@mysql_query($db_insert_admin_settings)) {
			echo("Time zone created successfully.");
		} else {
			echo("Error creating time zone.");
		}
	} else {
		echo("Time zone address already exists.");
	}

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

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

if ($page == "settings" and $request =="edit_time_zone" and $admin_rights == "Admin") {

	echo("<b>Settings - Edit Time Zone</b><p>");

	$admin_settings_id = $_GET['admin_settings_id'];

	$db_lookup_admin_settings = @mysql_query("SELECT id, setting FROM admin_settings WHERE id='$admin_settings_id'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_id = $db_admin_settings['id'];
	$db_admin_settings_setting = $db_admin_settings['setting'];
	
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=settings&request=edit_time_zone_submit' method='post'>");
	echo("<input type='hidden' name='admin_settings_id' value='$db_admin_settings_id'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Time Zone:</font></td>");
	echo("<td>" . $font_body . "");
	echo("<select size='1' name='time_zone'>");
	if ($db_admin_settings_setting == "-12") {
		echo("<option value='-12' selected>UTC-12</option>");
	} else {
		echo("<option value='-12'>UTC-12</option>");
	}
	if ($db_admin_settings_setting == "-11") {
		echo("<option value='-11' selected>UTC-11</option>");
	} else {
		echo("<option value='-11'>UTC-11</option>");
	}
	if ($db_admin_settings_setting == "-10") {
		echo("<option value='-10' selected>UTC-10</option>");
	} else {
		echo("<option value='-10'>UTC-10</option>");
	}
	if ($db_admin_settings_setting == "-9") {
		echo("<option value='-9.5' selected>UTC-9:30</option>");
	} else {
		echo("<option value='-9.5'>UTC-9:30</option>");
	}
	if ($db_admin_settings_setting == "-9") {
		echo("<option value='-9' selected>UTC-9</option>");
	} else {
		echo("<option value='-9'>UTC-9</option>");
	}
	if ($db_admin_settings_setting == "-8") {
		echo("<option value='-8' selected>UTC-8</option>");
	} else {
		echo("<option value='-8'>UTC-8</option>");
	}
	if ($db_admin_settings_setting == "-7") {
		echo("<option value='-7' selected>UTC-7</option>");
	} else {
		echo("<option value='-7'>UTC-7</option>");
	}
	if ($db_admin_settings_setting == "-6") {
		echo("<option value='-6' selected>UTC-6</option>");
	} else {
		echo("<option value='-6'>UTC-6</option>");
	}
	if ($db_admin_settings_setting == "-5") {
		echo("<option value='-5' selected>UTC-5</option>");
	} else {
		echo("<option value='-5'>UTC-5</option>");
	}
	if ($db_admin_settings_setting == "-4.5") {
		echo("<option value='-4.5' selected>UTC-4:30</option>");
	} else {
		echo("<option value='-4.5'>UTC-4:30</option>");
	}
	if ($db_admin_settings_setting == "-4") {
		echo("<option value='-4' selected>UTC-4</option>");
	} else {
		echo("<option value='-4'>UTC-4</option>");
	}
	if ($db_admin_settings_setting == "-3.5") {
		echo("<option value='-3.5' selected>UTC-3:30</option>");
	} else {
		echo("<option value='-3.5'>UTC-3:30</option>");
	}
	if ($db_admin_settings_setting == "-3") {
		echo("<option value='-3' selected>UTC-3</option>");
	} else {
		echo("<option value='-3'>UTC-3</option>");
	}
	if ($db_admin_settings_setting == "-2") {
		echo("<option value='-2' selected>UTC-2</option>");
	} else {
		echo("<option value='-2'>UTC-2</option>");
	}
	if ($db_admin_settings_setting == "-1") {
		echo("<option value='-1' selected>UTC-1</option>");
	} else {
		echo("<option value='-1'>UTC-1</option>");
	}
	if ($db_admin_settings_setting == "0") {
		echo("<option value='0' selected>UTC</option>");
	} else {
		echo("<option value='0'>UTC</option>");
	}
	if ($db_admin_settings_setting == "+1") {
		echo("<option value='+1' selected>UTC+1</option>");
	} else {
		echo("<option value='+1'>UTC+1</option>");
	}
	if ($db_admin_settings_setting == "+2") {
		echo("<option value='+2' selected>UTC+2</option>");
	} else {
		echo("<option value='+2'>UTC+2</option>");
	}
	if ($db_admin_settings_setting == "+3") {
		echo("<option value='+3' selected>UTC+3</option>");
	} else {
		echo("<option value='+3'>UTC+3</option>");
	}
	if ($db_admin_settings_setting == "+3.5") {
		echo("<option value='+3.5' selected>UTC+3:30</option>");
	} else {
		echo("<option value='+3.5'>UTC+3:30</option>");
	}
	if ($db_admin_settings_setting == "+4") {
		echo("<option value='+4' selected>UTC+4</option>");
	} else {
		echo("<option value='+4'>UTC+4</option>");
	}
	if ($db_admin_settings_setting == "+4.5") {
		echo("<option value='+4.5' selected>UTC+4:30</option>");
	} else {
		echo("<option value='+4.5'>UTC+4:30</option>");
	}
	if ($db_admin_settings_setting == "+5") {
		echo("<option value='+5' selected>UTC+5</option>");
	} else {
		echo("<option value='+5'>UTC+5</option>");
	}
	if ($db_admin_settings_setting == "+5.5") {
		echo("<option value='+5.5' selected>UTC+5:30</option>");
	} else {
		echo("<option value='+5.5'>UTC+5:30</option>");
	}
	if ($db_admin_settings_setting == "+5.75") {
		echo("<option value='+5.75' selected>UTC+5:45</option>");
	} else {
		echo("<option value='+5.75'>UTC+5:45</option>");
	}
	if ($db_admin_settings_setting == "+6") {
		echo("<option value='+6' selected>UTC+6</option>");
	} else {
		echo("<option value='+6'>UTC+6</option>");
	}
	if ($db_admin_settings_setting == "+6.5") {
		echo("<option value='+6.5' selected>UTC+6:30</option>");
	} else {
		echo("<option value='+6.5'>UTC+6:30</option>");
	}
	if ($db_admin_settings_setting == "+7") {
		echo("<option value='+7' selected>UTC+7</option>");
	} else {
		echo("<option value='+7'>UTC+7</option>");
	}
	if ($db_admin_settings_setting == "+8") {
		echo("<option value='+8' selected>UTC+8</option>");
	} else {
		echo("<option value='+8'>UTC+8</option>");
	}
	if ($db_admin_settings_setting == "+8.75") {
		echo("<option value='+8.75' selected>UTC+8:45</option>");
	} else {
		echo("<option value='+8.75'>UTC+8:45</option>");
	}
	if ($db_admin_settings_setting == "+9") {
		echo("<option value='+9' selected>UTC+9</option>");
	} else {
		echo("<option value='+9'>UTC+9</option>");
	}
	if ($db_admin_settings_setting == "+9.5") {
		echo("<option value='+9.5' selected>UTC+9:30</option>");
	} else {
		echo("<option value='+9.5'>UTC+9:30</option>");
	}
	if ($db_admin_settings_setting == "+10") {
		echo("<option value='+10' selected>UTC+10</option>");
	} else {
		echo("<option value='+10'>UTC+10</option>");
	}
	if ($db_admin_settings_setting == "+10.5") {
		echo("<option value='+10.5' selected>UTC+10:30</option>");
	} else {
		echo("<option value='+10.5'>UTC+10:30</option>");
	}
	if ($db_admin_settings_setting == "+11") {
		echo("<option value='+11' selected>UTC+11</option>");
	} else {
		echo("<option value='+11'>UTC+11</option>");
	}
	if ($db_admin_settings_setting == "+11.5") {
		echo("<option value='+11.5' selected>UTC+11:30</option>");
	} else {
		echo("<option value='+11.5'>UTC+11:30</option>");
	}
	if ($db_admin_settings_setting == "+12") {
		echo("<option value='+12' selected>UTC+12</option>");
	} else {
		echo("<option value='+12'>UTC+12</option>");
	}
	if ($db_admin_settings_setting == "+12.75") {
		echo("<option value='+12.75' selected>UTC+12:45</option>");
	} else {
		echo("<option value='+12.75'>UTC+12:45</option>");
	}
	if ($db_admin_settings_setting == "+13") {
		echo("<option value='+13' selected>UTC+13</option>");
	} else {
		echo("<option value='+13'>UTC+13</option>");
	}
	if ($db_admin_settings_setting == "+14") {
		echo("<option value='+14' selected>UTC+14</option>");
	} else {
		echo("<option value='+14'>UTC+14</option>");
	}
	echo("</select>");
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Update'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");

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

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

if ($page == "settings" and $request =="edit_time_zone_submit" and $admin_rights == "Admin") {

	echo("<b>Settings - Edit Time Zone</b><p>");

	$admin_settings_id = $_POST['admin_settings_id'];
	$time_zone = $_POST['time_zone'];
	
	$db_update_admin_settings = "UPDATE admin_settings SET " . 
		"setting = '$time_zone'" .  
		"WHERE id = '$admin_settings_id'";
	
	if (@mysql_query($db_update_admin_settings)) {
		echo("Time zone updated successfully.");
	} else {
		echo("Time zone update error.");
	}

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

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

if ($page == "settings" and $request == "new_dst" and $admin_rights == "Admin") {

	echo("<b>Settings - New Daylight Savings Time</b><p>");

	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=settings&request=new_dst_submit' method='post'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Daylight Savings Time:</font></td>");
	echo("<td>" . $font_body . "");
	echo("<select size='1' name='dst'>");
	echo("<option value='On'>On</option>");
	echo("<option value='Off'>Off</option>");
	echo("</select>");
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Submit'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");
	echo("<p>");
	
	echo("[<a href='" . $_SERVER['PHP_SELF'] . "?page=settings'>" . $link_color . "Settings</font></a>]<p>");
}

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

if ($page == "settings" and $request == "new_dst_submit" and $admin_rights == "Admin") {

	echo("<b>Settings - New Daylight Savings Time</b><p>");

	$dst = $_POST['dst'];

	$db_lookup_admin_settings = @mysql_query("SELECT setting FROM admin_settings WHERE setting_type='dst'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_setting = $db_admin_settings['setting'];

	if (!$db_admin_settings_setting) {
	
		$db_insert_admin_settings = "INSERT INTO admin_settings SET " . 
			"setting_type = 'dst', " .  
			"setting = '$dst'";
		
		if (@mysql_query($db_insert_admin_settings)) {
			echo("Daylight savings time created successfully.");
		} else {
			echo("Error creating daylight savings time.");
		}
	} else {
		echo("Daylight savings time already exists.");
	}

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

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

if ($page == "settings" and $request == "edit_dst" and $admin_rights == "Admin") {

	echo("<b>Settings - Edit Daylight Savings Time</b><p>");

	$admin_settings_id = $_GET['admin_settings_id'];

	$db_lookup_admin_settings = @mysql_query("SELECT id, setting FROM admin_settings WHERE id='$admin_settings_id'");
	$db_admin_settings = @mysql_fetch_array($db_lookup_admin_settings);

	$db_admin_settings_id = $db_admin_settings['id'];
	$db_admin_settings_setting = $db_admin_settings['setting'];
	
	echo("<form action='" . $_SERVER['PHP_SELF'] . "?page=settings&request=edit_dst_submit' method='post'>");
	echo("<input type='hidden' name='admin_settings_id' value='$db_admin_settings_id'>");
	echo("<table border='0' cellpadding='5' cellspacing='0'>");
	echo("<tr>");
	echo("<td>" . $font_body . "Daylight Savings Time:</font></td>");
	echo("<td>" . $font_body . "");
	echo("<select size='1' name='dst'>");
	if ($db_admin_settings_setting == "On") {
		echo("<option value='On' selected>On</option>");
	} else {
		echo("<option value='On'>On</option>");
	}
	if ($db_admin_settings_setting == "Off") {
		echo("<option value='Off' selected>Off</option>");
	} else {
		echo("<option value='Off'>Off</option>");
	}
	echo("</select>");
	echo("</font></td>");
	echo("</tr>");
	echo("<tr>");
	echo("<td>" . $font_body . "&nbsp;</font></td>");
	echo("<td>" . $font_body . "<input type='submit' name ='submit' value ='Update'></font></td>");
	echo("</tr>");
	echo("</table>");
	echo("</form>");

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

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

if ($page == "settings" and $request =="edit_dst_submit" and $admin_rights == "Admin") {

	echo("<b>Settings - Edit Daylight Savings Time</b><p>");

	$admin_settings_id = $_POST['admin_settings_id'];
	$dst = $_POST['dst'];
	
	$db_update_admin_settings = "UPDATE admin_settings SET " . 
		"setting = '$dst'" .  
		"WHERE id = '$admin_settings_id'";
	
	if (@mysql_query($db_update_admin_settings)) {
		echo("Daylight savings time updated successfully.");
	} else {
		echo("Daylight savings time update error.");
	}

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

?>
Return current item: Free Simple Shop