????
| Current Path : /home2/morganrand/www/store/ |
| Current File : /home2/morganrand/www/store/login.php |
<?php
/*
Consolidated Login Page with Guest Checkout for 2.3.1 v 1.0
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Copyright (c) 2012 osCbyJetta
Released under the GNU General Public License
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);
if ($session_started == false) tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
$processAccount = false;
$processGuest = false;
if (isset($_POST['action']))
{
switch($_POST['action'])
{
case 'login':
if (isset($_POST['formid']) && ($_POST['formid'] == $sessiontoken))
{
$error = false;
$email_address = tep_db_prepare_input($_POST['email_address']);
$password = tep_db_prepare_input($_POST['password']);
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
if (!tep_db_num_rows($check_customer_query)) $error = true;
else
{
$check_customer = tep_db_fetch_array($check_customer_query);
if (!tep_validate_password($password, $check_customer['customers_password'])) $error = true;
elseif($check_guest_query = tep_db_fetch_array(tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and customers_guest = '1' limit 1")))
$error = true;
else
{
if (SESSION_RECREATE == 'True') tep_session_recreate();
if (tep_password_type($check_customer['customers_password']) != 'phpass')
tep_db_query("update " . TABLE_CUSTOMERS . " set customers_password = '" . tep_encrypt_password($password) . "' where customers_id = '" . (int)$check_customer['customers_id'] . "'");
$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
$check_country = tep_db_fetch_array($check_country_query);
$customer_id = $check_customer['customers_id'];
$customer_default_address_id = $check_customer['customers_default_address_id'];
$customer_first_name = $check_customer['customers_firstname'];
$customer_country_id = $check_country['entry_country_id'];
$customer_zone_id = $check_country['entry_zone_id'];
tep_session_register('customer_id');
tep_session_register('customer_default_address_id');
tep_session_register('customer_first_name');
tep_session_register('customer_country_id');
tep_session_register('customer_zone_id');
tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");
$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
$cart->restore_contents();
$wishList->restore_wishlist();
if (sizeof($navigation->snapshot) > 0)
{
$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
$navigation->clear_snapshot();
tep_redirect($origin_href);
}
elseif($cart->count_contents()>0) tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING));
elseif($_POST['action'] = 'wishlist') {
tep_redirect(tep_href_link(FILENAME_WISHLIST));
}
else tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
}
if ($error == true) $messageStack->add('login', TEXT_LOGIN_ERROR);
}
break;
case 'forgot':
if(isset($_POST['formid']) && $_POST['formid'] == $sessiontoken)
{
$email_address = tep_db_prepare_input($_POST['email_address']);
$check_customer_query = tep_db_query("select customers_firstname, customers_lastname, customers_password, customers_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
if (tep_db_num_rows($check_customer_query))
{
if($check_guest_query = tep_db_fetch_array(tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and customers_guest = '1' limit 1")))
{
$messageStack->add('login', TEXT_NO_EMAIL_ADDRESS_FOUND);
break;
}
$check_customer = tep_db_fetch_array($check_customer_query);
$new_password = tep_create_random_value(ENTRY_PASSWORD_MIN_LENGTH);
$crypted_password = tep_encrypt_password($new_password);
tep_db_query("update " . TABLE_CUSTOMERS . " set customers_password = '" . tep_db_input($crypted_password) . "' where customers_id = '" . (int)$check_customer['customers_id'] . "'");
tep_mail($check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'], $email_address, EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
$messageStack->add_session('login', SUCCESS_PASSWORD_SENT, 'success');
//echo $email_address.' '.$check_customer['customers_firstname'].EMAIL_PASSWORD_REMINDER_SUBJECT;
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
else $messageStack->add('login', TEXT_NO_EMAIL_ADDRESS_FOUND);
}
break;
case 'account':
case 'guest':
if (isset($_POST['formid']) && $_POST['formid'] == $sessiontoken)
{
$processAccount = true;
if($_POST['action'] == 'guest') {
$processGuest = true;
$return_guest = false;
}
elseif($_POST['action'] == 'account') {
if (ACCOUNT_GENDER == 'true') {
if (isset($_POST['gender'])) $gender = tep_db_prepare_input($_POST['gender']);
else $gender = false;
}
}
$firstname = tep_db_prepare_input($_POST['firstname']);
$lastname = tep_db_prepare_input($_POST['lastname']);
if($_POST['action'] == 'account') {
if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($_POST['dob']);
}
$email_address = tep_db_prepare_input($_POST['email_address']);
if($_POST['action'] == 'account') {
if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($_POST['company']);
}
$street_address = tep_db_prepare_input($_POST['street_address']);
if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($_POST['suburb']);
$postcode = tep_db_prepare_input($_POST['postcode']);
$city = tep_db_prepare_input($_POST['city']);
if (ACCOUNT_STATE == 'true')
{
$state = tep_db_prepare_input($_POST['state']);
if (isset($_POST['zone_id'])) $zone_id = tep_db_prepare_input($_POST['zone_id']);
else $zone_id = false;
}
$country = tep_db_prepare_input($_POST['country']);
if($_POST['action'] == 'account' || ($_POST['action'] == 'guest' && GUEST_CHECKOUT_TELEPHONE == 'True')) {
$telephone = tep_db_prepare_input($_POST['telephone']);
}
if($_POST['action'] == 'account') {
$fax = tep_db_prepare_input($_POST['fax']);
if (isset($_POST['newsletter'])) $newsletter = tep_db_prepare_input($_POST['newsletter']);
else $newsletter = false;
$password = tep_db_prepare_input($_POST['password']);
$confirmation = tep_db_prepare_input($_POST['confirmation']);
}
$error = false;
if($_POST['action'] == 'account') {
if (ACCOUNT_GENDER == 'true')
{
if ( ($gender != 'm') && ($gender != 'f') )
{
$error = true;
$messageStack->add('login', ENTRY_GENDER_ERROR);
}
}
}
if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_FIRST_NAME_ERROR);
}
if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_LAST_NAME_ERROR);
}
if($_POST['action'] == 'account') {
if (ACCOUNT_DOB == 'true')
{
if ((is_numeric(tep_date_raw($dob)) == false) || (@checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false))
{
$error = true;
$messageStack->add('login', ENTRY_DATE_OF_BIRTH_ERROR);
}
}
}
if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_EMAIL_ADDRESS_ERROR);
}
elseif (tep_validate_email($email_address) == false)
{
$error = true;
$messageStack->add('login', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
else
{
$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
$check_email = tep_db_fetch_array($check_email_query);
if ($check_email['total'] > 0)
{
if($check_guest_query = tep_db_fetch_array(tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and customers_guest = '1' limit 1")))
{
$return_guest = true;
$customers_id = $check_guest_query['customers_id'];
}
else {
$error = true;
$messageStack->add('login', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
}
}
}
if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_STREET_ADDRESS_ERROR);
}
if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_POST_CODE_ERROR);
}
if (strlen($city) < ENTRY_CITY_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_CITY_ERROR);
}
if (is_numeric($country) == false)
{
$error = true;
$messageStack->add('login', ENTRY_COUNTRY_ERROR);
}
if (ACCOUNT_STATE == 'true')
{
$zone_id = 0;
$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
$check = tep_db_fetch_array($check_query);
$entry_state_has_zones = ($check['total'] > 0);
if ($entry_state_has_zones == true)
{
$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')");
if (tep_db_num_rows($zone_query) == 1)
{
$zone = tep_db_fetch_array($zone_query);
$zone_id = $zone['zone_id'];
}
else
{
$error = true;
$messageStack->add('login', ENTRY_STATE_ERROR_SELECT);
}
}
elseif (strlen($state) < ENTRY_STATE_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_STATE_ERROR);
}
}
if($_POST['action'] == 'account' || ($_POST['action'] == 'guest' && GUEST_CHECKOUT_TELEPHONE == 'True')) {
if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_TELEPHONE_NUMBER_ERROR);
}
}
if($_POST['action'] == 'account') {
if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH)
{
$error = true;
$messageStack->add('login', ENTRY_PASSWORD_ERROR);
}
elseif ($password != $confirmation)
{
$error = true;
$messageStack->add('login', ENTRY_PASSWORD_ERROR_NOT_MATCHING);
}
}
if ($error == false)
{
$sql_data_array = array(
'customers_firstname' => $firstname,
'customers_lastname' => $lastname,
'customers_email_address' => $email_address);
if($_POST['action'] == 'account' || ($_POST['action'] == 'guest' && GUEST_CHECKOUT_TELEPHONE == 'True')) {
$sql_data_array['customers_telephone'] = $telephone;
}
if($_POST['action'] == 'account') {
$sql_data_array['customers_fax'] = $fax;
$sql_data_array['customers_newsletter'] = $newsletter;
$sql_data_array['customers_password'] = tep_encrypt_password($password);
if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);
}
if ($return_guest == true) {
$reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'");
while ($reviews = tep_db_fetch_array($reviews_query))
tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$reviews['reviews_id'] . "'");
tep_db_query("delete from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'");
tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customers_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customers_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customers_id . "'");
tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int)$customers_id . "'");
$sql_data_array['customers_id'] = $customers_id;
}
if($_POST['action'] == 'guest') {
$sql_data_array['customers_guest'] = 1;
}
elseif($_POST['action'] == 'account') {
$sql_data_array['customers_guest'] = 0;
}
tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);
if ($return_guest == false) {
$customer_id = tep_db_insert_id();
}
else {
$customer_id = $customers_id;
}
$sql_data_array = array(
'customers_id' => $customer_id,
'entry_firstname' => $firstname,
'entry_lastname' => $lastname,
'entry_street_address' => $street_address,
'entry_postcode' => $postcode,
'entry_city' => $city,
'entry_country_id' => $country);
if($_POST['action'] == 'account') {
if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
}
if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
if (ACCOUNT_STATE == 'true')
{
if ($zone_id > 0)
{
$sql_data_array['entry_zone_id'] = $zone_id;
$sql_data_array['entry_state'] = '';
}
else
{
$sql_data_array['entry_zone_id'] = '0';
$sql_data_array['entry_state'] = $state;
}
}
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
$address_id = tep_db_insert_id();
tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");
if (SESSION_RECREATE == 'True') tep_session_recreate();
$customer_first_name = $firstname;
$customer_default_address_id = $address_id;
$customer_country_id = $country;
$customer_zone_id = $zone_id;
tep_session_register('customer_id');
tep_session_register('customer_first_name');
tep_session_register('customer_default_address_id');
tep_session_register('customer_country_id');
tep_session_register('customer_zone_id');
$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
if($_POST['action'] == 'account') {
$cart->restore_contents();
$wishList->restore_wishlist();
$name = $firstname . ' ' . $lastname;
if (ACCOUNT_GENDER == 'true')
{
if ($gender == 'm') $email_text = sprintf(EMAIL_GREET_MR, $lastname);
else $email_text = sprintf(EMAIL_GREET_MS, $lastname);
}
else $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
$email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
elseif($_POST['action'] == 'guest') {
tep_session_register('guest');
}
if (sizeof($navigation->snapshot) > 0 && $_POST['action'] == 'guest')
{
$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
$navigation->clear_snapshot();
tep_redirect($origin_href);
}
elseif($_POST['action'] == 'wishlist'){
tep_redirect(tep_href_link(FILENAME_WISHLIST, '', 'SSL'));
}
else tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
}
}
break;
}
}
if ((isset($_POST['action']) && $_POST['action'] == 'login') || (!isset($_GET['form']) && !isset($_POST['action'])))
$breadcrumb->add(NAVBAR_TITLE_LOGIN, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
elseif ((isset($_POST['action']) && $_POST['action'] == 'forgot') || (isset($_GET['form']) && $_GET['form'] == 'forgot'))
{
$breadcrumb->add(NAVBAR_TITLE_LOGIN, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_FORGOT, tep_href_link(FILENAME_LOGIN, 'form=forgot', 'SSL'));
}
elseif ((isset($_POST['action']) && $_POST['action'] == 'account') || (isset($_GET['form']) && $_GET['form'] == 'account'))
$breadcrumb->add(NAVBAR_TITLE_ACCOUNT, tep_href_link(FILENAME_LOGIN, 'form=account', 'SSL'));
require(DIR_WS_INCLUDES.'template_top.php');
?>
<?php if ($messageStack->size('login') > 0) echo $messageStack->output('login'); ?>
<?php if ((isset($_POST['action']) && $_POST['action'] == 'login') || (!isset($_GET['form']) && !isset($_POST['action']))) { ?>
<h1><?php echo HEADING_TITLE_LOGIN; ?></h1>
<div class="contentContainer" style="width: 45%; float: left;">
<h2><?php echo HEADING_NEW_CUSTOMER; ?></h2>
<div class="contentText">
<p><?php echo TEXT_NEW_CUSTOMER; ?></p>
<p><?php echo TEXT_NEW_CUSTOMER_INTRODUCTION; ?></p>
<p align="right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_LOGIN, 'form=account', 'SSL')); ?></p>
<?php if (sizeof($navigation->snapshot) > 0 && GUEST_CHECKOUT_ENABLED == 'True') { ?>
<hr>
<br>
<h2><?php echo TEXT_GUEST_CUSTOMER; ?></h2>
<p><?php echo TEXT_GUEST_CUSTOMER_INTRODUCTION; ?></p>
<p align="right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_LOGIN, 'form=guest', 'SSL')); ?></p>
<?php } ?>
</div>
</div>
<div id="login" class="contentContainer" style="width: 45%; float: left; border-left: 1px dashed #ccc; padding-left: 3%; margin-left: 3%;">
<h2><?php echo HEADING_RETURNING_CUSTOMER; ?></h2>
<div class="contentText">
<p><?php echo TEXT_RETURNING_CUSTOMER; ?></p>
<?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, '', 'SSL'), 'post', '', true) . tep_draw_hidden_field('action', 'login'); ?>
<table border="0" cellspacing="3" cellpadding="2" width="100%">
<tr>
<td class="fieldKey"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('email_address'); ?></td>
</tr>
<tr>
<td class="fieldKey"><?php echo ENTRY_PASSWORD; ?></td>
<td class="fieldValue"><?php echo tep_draw_password_field('password'); ?></td>
</tr>
</table>
<p><?php echo '<a href="' . tep_href_link(FILENAME_LOGIN, 'form=forgot', 'SSL') . '">' . TEXT_PASSWORD_FORGOTTEN . '</a>'; ?></p>
<p align="right"><?php echo tep_draw_button(IMAGE_BUTTON_LOGIN, 'key', null, 'primary'); ?></p>
</form>
</div>
</div>
<?php } elseif ((isset($_POST['action']) && $_POST['action'] == 'forgot') || (isset($_GET['form']) && $_GET['form'] == 'forgot')) { ?>
<h1><?php echo HEADING_TITLE_FORGOT; ?></h1>
<div id="forgot" class="contentContainer">
<div class="contentText">
<div><?php echo TEXT_MAIN; ?></div>
<?php echo tep_draw_form('password_forgotten', tep_href_link(FILENAME_LOGIN, '', 'SSL'), 'post', '', true) . tep_draw_hidden_field('action', 'forgot'); ?>
<table border="0" width="100%" cellspacing="3" cellpadding="2">
<tr>
<td class="fieldKey"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('email_address'); ?></td>
</tr>
</table>
</div>
<div class="buttonSet">
<span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></span>
<?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'triangle-1-w', tep_href_link(FILENAME_LOGIN, '', 'SSL')); ?>
</form>
</div>
</div>
<?php } elseif ((isset($_POST['action']) && ($_POST['action'] == 'account' || $_POST['action'] == 'guest')) || (isset($_GET['form']) && ($_GET['form'] == 'account' || $_GET['form'] == 'guest'))) { ?>
<?php require('includes/form_check.js.php'); ?>
<h1><?php echo HEADING_TITLE_ACCOUNT; ?></h1>
<p><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, '', 'SSL')); ?></p>
<div id="account" class="contentContainer">
<?php if($_POST['action'] == 'account' || $_GET['form'] == 'account') { ?>
<?php echo tep_draw_form('create_account', tep_href_link(FILENAME_LOGIN, '', 'SSL'), 'post', 'onsubmit="return check_form(create_account);"', true) . tep_draw_hidden_field('action', 'account'); ?>
<?php } elseif($_POST['action'] == 'guest' || $_GET['form'] == 'guest') {
echo tep_draw_form('guest_account', tep_href_link(FILENAME_LOGIN, '', 'SSL'), 'post', 'onsubmit="return check_form(guest_account);"', true) . tep_draw_hidden_field('action', 'guest');
} ?>
<div>
<span class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></span>
<h2><?php echo CATEGORY_PERSONAL; ?></h2>
</div>
<div class="contentText">
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<?php if($_POST['action'] == 'account' || $_GET['form'] == 'account') { ?>
<?php if (ACCOUNT_GENDER == 'true') { ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_GENDER; ?></td>
<td class="fieldValue"><?php echo tep_draw_radio_field('gender', 'm') . ' ' . MALE . ' ' . tep_draw_radio_field('gender', 'f') . ' ' . FEMALE . ' ' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
</tr>
<?php } ?>
<?php } ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_FIRST_NAME; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('firstname') . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
</tr>
<tr>
<td class="fieldKey"><?php echo ENTRY_LAST_NAME; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('lastname') . ' ' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
</tr>
<?php if($_POST['action'] == 'account' || $_GET['form'] == 'account') { ?>
<?php if (ACCOUNT_DOB == 'true') { ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('dob', '', 'id="dob"') . ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?><script type="text/javascript">$('#dob').datepicker({dateFormat: '<?php echo JQUERY_DATEPICKER_FORMAT; ?>', changeMonth: true, changeYear: true, yearRange: '-100:+0'});</script></td>
</tr>
<?php } ?>
<?php } ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('email_address') . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
</tr>
</table>
</div>
<?php if($_POST['action'] == 'account' || $_GET['form'] == 'account') { ?>
<?php if (ACCOUNT_COMPANY == 'true') { ?>
<h2><?php echo CATEGORY_COMPANY; ?></h2>
<div class="contentText">
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<tr>
<td class="fieldKey"><?php echo ENTRY_COMPANY; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('company') . ' ' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>
</tr>
</table>
</div>
<?php } ?>
<?php } ?>
<h2><?php echo CATEGORY_ADDRESS; ?></h2>
<div class="contentText">
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<tr>
<td class="fieldKey"><?php echo ENTRY_STREET_ADDRESS; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('street_address') . ' ' . (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>
</tr>
<?php if (ACCOUNT_SUBURB == 'true') { ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_SUBURB; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('suburb') . ' ' . (tep_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>
</tr>
<?php } ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_POST_CODE; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('postcode') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
</tr>
<tr>
<td class="fieldKey"><?php echo ENTRY_CITY; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('city') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
</tr>
<?php if (ACCOUNT_STATE == 'true') { ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_STATE; ?></td>
<td class="fieldValue">
<?php
if ($processAccount == true)
{
if ($entry_state_has_zones == true)
{
$zones_array = array();
$zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");
while ($zones_values = tep_db_fetch_array($zones_query)) {
$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
}
echo tep_draw_pull_down_menu('state', $zones_array);
}
else echo tep_draw_input_field('state');
}
else echo tep_draw_input_field('state');
if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>';
?>
</td>
</tr>
<?php } ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_COUNTRY; ?></td>
<td class="fieldValue"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
</tr>
</table>
</div>
<?php if(($_POST['action'] == 'account' || $_GET['form'] == 'account') || (($_POST['action'] == 'guest' || $_GET['form'] == 'guest') && GUEST_CHECKOUT_TELEPHONE == 'True') ) { ?>
<h2><?php echo CATEGORY_CONTACT; ?></h2>
<div class="contentText">
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<tr>
<td class="fieldKey"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
</tr>
<?php if($_POST['action'] == 'account' || $_GET['form'] == 'account') { ?>
<tr>
<td class="fieldKey"><?php echo ENTRY_FAX_NUMBER; ?></td>
<td class="fieldValue"><?php echo tep_draw_input_field('fax') . ' ' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td>
</tr>
<tr>
<td class="fieldKey"><?php echo ENTRY_NEWSLETTER; ?></td>
<td class="fieldValue"><?php echo tep_draw_checkbox_field('newsletter', '1') . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
<?php if($_POST['action'] == 'account' || $_GET['form'] == 'account') { ?>
<h2><?php echo CATEGORY_PASSWORD; ?></h2>
<div class="contentText">
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<tr>
<td class="fieldKey"><?php echo ENTRY_PASSWORD; ?></td>
<td class="fieldValue"><?php echo tep_draw_password_field('password') . ' ' . (tep_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_TEXT . '</span>': ''); ?></td>
</tr>
<tr>
<td class="fieldKey"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>
<td class="fieldValue"><?php echo tep_draw_password_field('confirmation') . ' ' . (tep_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>': ''); ?></td>
</tr>
</table>
</div>
<?php } ?>
<div class="buttonSet">
<span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'person', null, 'primary'); ?></span>
</div>
</form>
</div>
<?php } ?>
<?php
require(DIR_WS_INCLUDES.'template_bottom.php');
require(DIR_WS_INCLUDES.'application_bottom.php');
?>