Jump to content
Latest News: (loading..)
kymation

[CONTRIBUTION] Admin Change Customer Passwords

Recommended Posts

I have version 2.2RC2, and, from reading this thread, it sounds like this contribution is not compatible as is with any version beyond 2.2MC2. If there is a kind soul out there who can give me a complete list of code changes that need to be made to make this contribution compatible with my version of OSC, I'd greatly appreciate it. Otherwise, I guess the client I'm building this shop for will just have to wait until after the contribution author (or someone else) uploads an update.

Share this post


Link to post
Share on other sites
I have version 2.2RC2, and, from reading this thread, it sounds like this contribution is not compatible as is with any version beyond 2.2MC2. If there is a kind soul out there who can give me a complete list of code changes that need to be made to make this contribution compatible with my version of OSC, I'd greatly appreciate it. Otherwise, I guess the client I'm building this shop for will just have to wait until after the contribution author (or someone else) uploads an update.

This contribution only makes a few minor changes to existing files. Most of the code is in new files. You shouldn't have any trouble adding this to any version after 2.2MS2.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites
I am getting the following error when i click on the change password link

 

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /www/users/ngnsky.com/admin/includes/functions/database.php:13) in /www/users/ngnsky.com/admin/includes/functions/database.php on line 13

 

 

 

pls help

Share this post


Link to post
Share on other sites

post 22


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Hi,

 

I installed this contribution before and works great. Now, I am installing in a different site. Problem is when I click on the Change Password which direct to admin/change_password.php, the screen shows nothing, just white screen.

 

Your help is greatly appreciated. Thank you so much!

Share this post


Link to post
Share on other sites
Rick

 

I think the problem is with the different versions of osCommerce. Try commenting out Line 17 of admin/includes/change_password.php and see if that works. You could also change the require() on that line to require_once().

 

This will only work if password_funcs.php is being included already in application_top.php. If that's not the case, this is another bogus error message. I'm hoping that's not it, since those are a bear to track down.

 

Regards

Jim

 

Hello,

 

I have the same problem

 

Fatal error: Cannot redeclare tep_validate_password() (previously declared in C:\Inetpub\vhosts\XXXX\httpdocs\includes\functions\password_funcs.php:16) in C:\Inetpub\vhosts\unnecessary-necessity.com\httpdocs\includes\functions\password_funcs.php on line 29

 

... I tried to find the admin/includes/change_password.php but could not find it in the includes, there is no file called change_password.php i searched the whole FTP to this File.

 

So how can i fix this issue.....

Share this post


Link to post
Share on other sites

Hello

I have error

help please

 

Fatal error: Cannot redeclare tep_validate_password() (previously declared in /admin/includes/functions/password_funcs.php:17) in /admin/includes/functions/password_funcs.php on line 30

 

thanks

Share this post


Link to post
Share on other sites
Hello

I have error

help please

 

Fatal error: Cannot redeclare tep_validate_password() (previously declared in /admin/includes/functions/password_funcs.php:17) in /admin/includes/functions/password_funcs.php on line 30

 

thanks

Check the two given lines for identical code.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

I am receiving same error as post 57 when trying to access my admin area. As per post 26, i did check for any misplaced files.

 

Here is my admin site link

 

Also looking in password_funcx.php file for these lines, here is what I see:

  Released under the GNU General Public License
*/

////
// This funstion validates a plain text password with an
// encrpyted password
 function tep_validate_password($plain, $encrypted) {
   if (tep_not_null($plain) && tep_not_null($encrypted)) {
// split apart the hash / salt
     $stack = explode(':', $encrypted);

     if (sizeof($stack) != 2) return false;

     if (md5($stack[1] . $plain) == $stack[0]) {
       return true;
     }
   }

   return false;
 }

////
// This function makes a new password from a plaintext password. 
 function tep_encrypt_password($plain) {
   $password = '';

   for ($i=0; $i<10; $i++) {
     $password .= tep_rand();
   }

   $salt = substr(md5($password), 0, 2);

   $password = md5($salt . $plain) . ':' . $salt;

   return $password;
 }

 

I even notice the (change my account password) is not an active link.

 

So are these two instances have soemthing in common?

Share this post


Link to post
Share on other sites

The issue with rhe error message has been solved.

 

But the issue of (change my account password) on the store side, is still not an active link. I will keep looking for a solution in mean time. But if someone knows of a post regarding this issue, I would be happy to know of it.

 

Thanks.

 

blr044

Share this post


Link to post
Share on other sites

Is there anyway, that the code can be changed to automatically email the new password to the user (as a confirmation), this will alert the customer to any unauthroised attempts to change passwords etc.

 

i.e.

 

define('EMAIL_PASSWORD_REMINDER_SUBJECT', STORE_NAME . ' - New Password');
 define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested for your account at ' . STORE_NAME . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is:' . "\n\n" . '   %s' . "\n\n");
 define('TEXT_PASSWORD_SENT_TO_CUST', 'New Password Sent To The Customers E-Mail Address');
 tep_mail($customer_data['customers_firstname'] . " " . $customer_data['customers_lastname'], $customer_data['customers_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $newpass)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

Edited by stu2000

Stuart

Share this post


Link to post
Share on other sites

Yes. Once you have selected the customer, you have their ID, so any other information can be pulled from the database and an automated message sent.

 

Since this contribution works from the Admin side, unauthorized changes are unlikely. An automated notice from the customer's account on the Catalog side would be more useful.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Trying for the last 30 minutes to insert the above code, I think it should go in change_password.php after lines 100 but it don't work, can anyone see anything obciously wrong.

 

// Set the correct message to display for password change or errors
 $message = '';
 switch ($pass) {
case 1:
  $message = '<b><font color=#009900>';
  $message .= CUSTOMER_PASSWORD . $customer_name['customers_firstname'] . ' ' . $customer_name['customers_lastname'];
  $message .= PASSWORD_UPDATED . ' ' . $new_password . '<br>' . PASSWORD_UPDATED_REMINDER;
  $message .= '</b></font><br>' . tep_black_line();

 define('EMAIL_PASSWORD_REMINDER_SUBJECT', STORE_NAME . ' - New Password');
 define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested for your account at ' . STORE_NAME . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is:' . "\n\n" . '   %s' . "\n\n");
 tep_mail($customer_data['customers_firstname'] . " " . $customer_data['customers_lastname'], $customer_data['customers_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $newpass)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  break;

 

also tried after line 57

 

// If all is well, make the changes to the database
if ($pass == 1) {
  mysql_query("UPDATE " . TABLE_CUSTOMERS . "
			   SET customers_password='" . tep_encrypt_password ($new_password) . "'
			   WHERE customers_id='" . $customer_id . "'
			");

// Get the customer's information for the success message
  $customer_name_query = mysql_query("SELECT customers_firstname,
											 customers_lastname
									  FROM " . TABLE_CUSTOMERS . "
									  WHERE customers_id='" . $customer_id . "'
								   ");
  $customer_name = mysql_fetch_array ($customer_name_query);

	define('EMAIL_PASSWORD_REMINDER_SUBJECT', STORE_NAME . ' - New Password');
 define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested for your account at ' . STORE_NAME . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is:' . "\n\n" . '   %s' . "\n\n");
 tep_mail($customer_data['customers_firstname'] . " " . $customer_data['customers_lastname'], $customer_data['customers_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $newpass)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 }
 }

 

no emails ever received.

Edited by stu2000

Stuart

Share this post


Link to post
Share on other sites

$customer_data is used to pull an array of all customers. It won't be valid for the current customer when the password has been changed -- that's in the POST section. You need to add your own SQL or change the existing to retrieve the correct customer information. Try this around Line 51:

	  $customer_name_query = mysql_query("SELECT customers_firstname,
											 customers_lastname
									  FROM " . TABLE_CUSTOMERS . "
									  WHERE customers_id='" . $customer_id . "'
								   ");
  $customer_name = mysql_fetch_array ($customer_name_query);

Change to:

	  $customer_name_query = mysql_query("SELECT customers_firstname,
											 customers_lastname,
											 customers_email_address
									  FROM " . TABLE_CUSTOMERS . "
									  WHERE customers_id='" . $customer_id . "'
								   ");
  $customer_name = mysql_fetch_array ($customer_name_query);

Then use $customer_name['customers_email_address'] etc. to populate your email. I would put the email code up in this section as well; the part you referenced was supposed to be for error/success messages.

 

Regards

Jim

 

Edit: Apparently I was doing this at the same time the parent post was changed. I was referring to the first block of code -- the second code block is very close tho what I was suggesting. That really should work if you retrieve the email address.

Edited by kymation

See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Thank you, it works now, using the following code:

 

// If all is well, make the changes to the database
if ($pass == 1) {
  mysql_query("UPDATE " . TABLE_CUSTOMERS . "
			   SET customers_password='" . tep_encrypt_password ($new_password) . "'
			   WHERE customers_id='" . $customer_id . "'
			");

// Get the customer's information for the success message
$customer_name_query = mysql_query("SELECT customers_firstname,
											 customers_lastname,
											 customers_email_address
									  FROM " . TABLE_CUSTOMERS . "
									  WHERE customers_id='" . $customer_id . "'
								   ");
  $customer_name = mysql_fetch_array ($customer_name_query);

 define('EMAIL_PASSWORD_REMINDER_SUBJECT', STORE_NAME . ' - New Password');
 define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested for your account at ' . STORE_NAME . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is:' . "\n\n" . '   %s' . "\n\n");
 tep_mail($customer_name['customers_firstname'] . " " . $customer_name['customers_lastname'], $customer_name['customers_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }
 }

 

Email received:

 

A new password was requested for your account at Company Name.

Your new password to 'Company Name' is:

  12345

 

Just need to do a few cosmetic changes etc and should be perfect.


Stuart

Share this post


Link to post
Share on other sites

If anyone is interested, here is my change_password.php file with a few cosmetic changes and the ability now to automatically email the customer with the new password (please note I have removed (commented out) the auto password generation)

 

 

<?php
/*
 $Id: change_password.php,v 3.0 11/23/2007 kymstion

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2007 osCommerce

 Released under the GNU General Public License
*/


 require('includes/application_top.php');

// Include the password functions
 require(DIR_WS_FUNCTIONS . 'password_funcs.php');

// Include the language definitions
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHANGE_PASSWORD);

//
// POST target -- the POST form has been sent to change a password
// If a password change has been submitted, check the results for errors
 $pass = 0;
 if ($_POST['customer_id'] != '') {
   $customer_id = (int)$_POST['customer_id'];

   if ($_POST['new_password'] == '' && $_POST['repeat_password'] == '') {  // Use generated password
     $pass = 1;
     $new_password = $_POST['auto_password'];
   } elseif ($_POST['new_password'] == $_POST['repeat_password']) {  // Use custom password
     $pass = 1;
     $new_password = $_POST['new_password'];
   } elseif (empty($_POST['new_password'])) {  // Missing password
     $pass = 2;
   } elseif (empty($_POST['repeat_password'])) {  // Missing repeat password
     $pass = 2;
   } elseif ($_POST['new_password'] != $_POST['repeat_password']) {  // Mismatched passwords
     $pass = 3;
   }

// If all is well, make the changes to the database
   if ($pass == 1) {
     mysql_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_password='" . tep_encrypt_password ($new_password) . "' WHERE customers_id='" . $customer_id . "'");

// Get the customer's information for the success message
$customer_name_query = mysql_query("SELECT customers_firstname, customers_lastname, customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . $customer_id . "'");
$customer_name = mysql_fetch_array ($customer_name_query);

 define('EMAIL_PASSWORD_REMINDER_SUBJECT', STORE_NAME . ' - New Password Generated');
 define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested for your account at ' . STORE_NAME . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is: ' .  '%s' . "\n\n" . 'If you did not authorise this, please contact us immediately.' . "\n\n" . STORE_OWNER . "\n" . STORE_OWNER_EMAIL_ADDRESS );
 tep_mail($customer_name['customers_firstname'] . " " . $customer_name['customers_lastname'], $customer_name['customers_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    }
 }
// End POST section

//
// GET target -- a GET form has been sent
// Build a SQL string from the Search or Customer variables
 $search_string = '';
 if (isset ($HTTP_GET_VARS['search']) && strlen ($HTTP_GET_VARS['search']) > 1)  {
   $keywords = tep_db_input (tep_db_prepare_input ($HTTP_GET_VARS['search']));
   $search_string = "where customers_lastname like '%" . $keywords . "%' or customers_firstname like '%" . $keywords . "%' or customers_email_address like '%" . $keywords . "%'";

 } elseif (isset ($HTTP_GET_VARS['customer'])) {
   $customer_id = (int)$HTTP_GET_VARS['customer'];
   $search_string = "WHERE customers_id='" . $customer_id . "'";
 }
// End GET section

//
// Variable fields to insert into the page
// Build an array of customers for the select pulldown
 $customer_data_query = mysql_query("SELECT customers_id,
                                            customers_firstname,
                                            customers_lastname,
                                            customers_email_address
                                     FROM " . TABLE_CUSTOMERS . "
                                          " . $search_string . "
                                     ORDER BY customers_lastname, customers_firstname
                                 ");
 $customers_array = array();
 while ($customer_data = mysql_fetch_array ($customer_data_query) ) {
   $customers_array[] = array('id' => $customer_data['customers_id'],
                              'text' => $customer_data['customers_firstname'] . ' ' . $customer_data['customers_lastname'] . ' (' . $customer_data['customers_email_address'] . ')'
                             );
 }

// Set the correct message to display for password change or errors
 $message = '';
 switch ($pass) {
   case 1:
     $message = '<b><font color=#009900>';
     $message .= CUSTOMER_PASSWORD . $customer_name['customers_firstname'] . ' ' . $customer_name['customers_lastname'];
     $message .= PASSWORD_UPDATED . ' <font color=red>' . $new_password . '</font><br>An Email has been sent to ' . $customer_name['customers_firstname'] . ' ' . $customer_name['customers_lastname'] . ' to verify this change.<br>';
     $message .= '</b></font><br>' . tep_black_line();
     break;
   case 2:
     $message = '<b><font color=#ff0000>'. PLEASE_NEW_PASSWORD . PLEASE_REPEAT . '</b></font>';
     break;
   case 3:
     $message = '<b><font color=#ff0000>'. ERROR_NEW_PASSWORD .  PLEASE_REPEAT . '</b></font>';
     break;
   case 0:
   default:
     $message = ' ';
     break;
 }

// Set up the search form
 $search_form = tep_draw_input_field ('search');
 $search_form .= tep_draw_hidden_field ('selected_box', 'customers');
 $search_form .= tep_hide_session_id();

// Generate a random password and add it to the form
 $auto_password = tep_create_random_value (ENTRY_PASSWORD_MIN_LENGTH);
 $auto_form = tep_draw_hidden_field ('auto_password', $auto_password) . $auto_password;

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
<?php if ($message != ' ') { ?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><?php echo $message; ?></td>
         </tr>
       </table></td>
     </tr>
<?php } ?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_form ('search', FILENAME_CHANGE_PASSWORD, '', 'get'); ?>
       <table border="0" width="600px" cellspacing="0" cellpadding="2">
	  <tr>
           <td width="170"><?php echo tep_draw_separator('pixel_trans.gif', '170', '1'); ?></td>
           <td width="150"><?php echo tep_draw_separator('pixel_trans.gif', '150', '1'); ?></td>
		<td width="280"><?php echo tep_draw_separator('pixel_trans.gif', '280', '1'); ?></td>
	  </tr>
	  <tr>
           <td class="main" colspan="3"><?php echo TEXT_SEARCH_INSTRUCTION; ?><br></td>
         </tr>
         <tr>
           <td width="170" class="main"><b><?php echo SEARCH; ?></b></td>
           <td width="150" class="main"><?php echo $search_form; ?></td>
		<td width="280" class="main"><?php echo tep_image_submit ('button_search.gif', IMAGE_SEARCH); ?></td>
	  </tr>
       </form></table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_form ('password', FILENAME_CHANGE_PASSWORD, 'selected_box=customers', 'POST'); ?>
       <table border=0 width="600px" cellspacing="0" cellpadding="2">
         <tr>
           <td width="170" class="main"><b><font color=red>OR</font><br><br><?php echo SELECT_CUSTOMER; ?></b><br><br></td>
           <td width="450" class="main"><br><br><?php echo tep_draw_pull_down_menu('customer_id', $customers_array);; ?><br><br></td>
         </tr>
         <tr>
           <td class="main"><b><?php echo NEW_PASSWORD; ?></b></td>
           <td class="main"><?php echo tep_draw_password_field('new_password'); ?></td>
         </tr>
         <tr>
           <td class="main"><b><?php echo REPEAT_NEW_PASSWORD; ?></b></td>
           <td class="main"><?php echo tep_draw_password_field('repeat_password'); ?></td>
         </tr>
<!--
	  <tr>
           <td class="main"><b><?php echo AUTO_PASSWORD; ?></b></td>
           <td class="main"><?php echo $auto_form; ?></td>
         </tr> 
-->

         <tr>
           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '170', '1'); ?></td>
           <td><?php echo tep_image_submit ('button_change_password.gif', IMAGE_CHANGE_PASSWORD); ?></td>
         </tr>
       </form></table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

A big thank you to Jim Keebaugh, for his help in completing this modification :)

Edited by stu2000

Stuart

Share this post


Link to post
Share on other sites

Thanks for the code. That's a good idea; I'll add it to the next release. Or you can do it if you want to.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Hi Jim, I won't steal your thunder, its all your work, the onloy thing I would do different with my code above is make it langauge independant, its set for english only, but a few changes to the defines, then it could be completely language universal, the script above is for a customers store of mine and they only sell in the UK, so english is all thats required.

 

If I have time, will change it to be universal.


Stuart

Share this post


Link to post
Share on other sites

I started to install this wonderful mod and when I get to item #8 I find that my store has customers_improved V1.4.2 installed instead of the one referenced in the contrition. I have included that file below. Can someone tell me where (and what code) to insert in this file? My first shot would say that it would go down around line 717 but the two files look so different that I am at a loss.

 

Thanks in advance

 

Jeff

 

 

 

 

<?php
/*
 $Id: customers_improved.php, v1.3b 2006/04/26 23:12:52 kremit Exp $

Customers Improved v1.4.2

Copyright (c) 2005 Wesley Haines
<kremit AT wrpn.net>, http://wrpn.net/


 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

if(isset($HTTP_POST_VARS['orderby'])) $orderby = tep_db_prepare_input($HTTP_POST_VARS['orderby']);
if(isset($HTTP_POST_VARS['sort'])) $sort = tep_db_prepare_input($HTTP_POST_VARS['sort']);
if(!$orderby) $orderby = 'lastname';
if(!$sort) $sort = 'ASC';

 $error = false;
 $processed = false;

 if (tep_not_null($action)) {
switch ($action) {
  case 'update':
	$customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
	$customers_firstname = tep_db_prepare_input($HTTP_POST_VARS['customers_firstname']);
	$customers_lastname = tep_db_prepare_input($HTTP_POST_VARS['customers_lastname']);
	$customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);
	$customers_telephone = tep_db_prepare_input($HTTP_POST_VARS['customers_telephone']);
	$customers_fax = tep_db_prepare_input($HTTP_POST_VARS['customers_fax']);
	$customers_newsletter = tep_db_prepare_input($HTTP_POST_VARS['customers_newsletter']);

	$customers_gender = tep_db_prepare_input($HTTP_POST_VARS['customers_gender']);
	$customers_dob = tep_db_prepare_input($HTTP_POST_VARS['customers_dob']);

	$default_address_id = tep_db_prepare_input($HTTP_POST_VARS['default_address_id']);
	$entry_street_address = tep_db_prepare_input($HTTP_POST_VARS['entry_street_address']);
	$entry_suburb = tep_db_prepare_input($HTTP_POST_VARS['entry_suburb']);
	$entry_postcode = tep_db_prepare_input($HTTP_POST_VARS['entry_postcode']);
	$entry_city = tep_db_prepare_input($HTTP_POST_VARS['entry_city']);
	$entry_country_id = tep_db_prepare_input($HTTP_POST_VARS['entry_country_id']);

	$entry_company = tep_db_prepare_input($HTTP_POST_VARS['entry_company']);
	$entry_state = tep_db_prepare_input($HTTP_POST_VARS['entry_state']);
	if (isset($HTTP_POST_VARS['entry_zone_id'])) $entry_zone_id = tep_db_prepare_input($HTTP_POST_VARS['entry_zone_id']);

	if (strlen($customers_firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
	  $error = true;
	  $entry_firstname_error = true;
	} else {
	  $entry_firstname_error = false;
	}

	if (strlen($customers_lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
	  $error = true;
	  $entry_lastname_error = true;
	} else {
	  $entry_lastname_error = false;
	}

	if (ACCOUNT_DOB == 'true') {
	  if (checkdate(substr(tep_date_raw($customers_dob), 4, 2), substr(tep_date_raw($customers_dob), 6, 2), substr(tep_date_raw($customers_dob), 0, 4))) {
		$entry_date_of_birth_error = false;
	  } else {
		$error = true;
		$entry_date_of_birth_error = true;
	  }
	}

	if (strlen($customers_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
	  $error = true;
	  $entry_email_address_error = true;
	} else {
	  $entry_email_address_error = false;
	}

	if (!tep_validate_email($customers_email_address)) {
	  $error = true;
	  $entry_email_address_check_error = true;
	} else {
	  $entry_email_address_check_error = false;
	}

	if (strlen($entry_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
	  $error = true;
	  $entry_street_address_error = true;
	} else {
	  $entry_street_address_error = false;
	}

	if (strlen($entry_postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
	  $error = true;
	  $entry_post_code_error = true;
	} else {
	  $entry_post_code_error = false;
	}

	if (strlen($entry_city) < ENTRY_CITY_MIN_LENGTH) {
	  $error = true;
	  $entry_city_error = true;
	} else {
	  $entry_city_error = false;
	}

	if ($entry_country_id == false) {
	  $error = true;
	  $entry_country_error = true;
	} else {
	  $entry_country_error = false;
	}

	if (ACCOUNT_STATE == 'true') {
	  if ($entry_country_error == true) {
		$entry_state_error = true;
	  } else {
		$zone_id = 0;
		$entry_state_error = false;
		$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry_country_id . "'");
		$check_value = tep_db_fetch_array($check_query);
		$entry_state_has_zones = ($check_value['total'] > 0);
		if ($entry_state_has_zones == true) {
		  $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry_country_id . "' and zone_name = '" . tep_db_input($entry_state) . "'");
		  if (tep_db_num_rows($zone_query) == 1) {
			$zone_values = tep_db_fetch_array($zone_query);
			$entry_zone_id = $zone_values['zone_id'];
		  } else {
			$error = true;
			$entry_state_error = true;
		  }
		} else {
		  if ($entry_state == false) {
			$error = true;
			$entry_state_error = true;
		  }
		}
	 }
  }

  if (strlen($customers_telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
	$error = true;
	$entry_telephone_error = true;
  } else {
	$entry_telephone_error = false;
  }

  $check_email = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($customers_email_address) . "' and customers_id != '" . (int)$customers_id . "'");
  if (tep_db_num_rows($check_email)) {
	$error = true;
	$entry_email_address_exists = true;
  } else {
	$entry_email_address_exists = false;
  }

  if ($error == false) {

	$sql_data_array = array('customers_firstname' => $customers_firstname,
							'customers_lastname' => $customers_lastname,
							'customers_email_address' => $customers_email_address,
							'customers_telephone' => $customers_telephone,
							'customers_fax' => $customers_fax,
							'customers_newsletter' => $customers_newsletter);

	if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $customers_gender;
	if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($customers_dob);

	tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "'");

	tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int)$customers_id . "'");

	if ($entry_zone_id > 0) $entry_state = '';

	$sql_data_array = array('entry_firstname' => $customers_firstname,
							'entry_lastname' => $customers_lastname,
							'entry_street_address' => $entry_street_address,
							'entry_postcode' => $entry_postcode,
							'entry_city' => $entry_city,
							'entry_country_id' => $entry_country_id);

	if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $entry_company;
	if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $entry_suburb;

	if (ACCOUNT_STATE == 'true') {
	  if ($entry_zone_id > 0) {
		$sql_data_array['entry_zone_id'] = $entry_zone_id;
		$sql_data_array['entry_state'] = '';
	  } else {
		$sql_data_array['entry_zone_id'] = '0';
		$sql_data_array['entry_state'] = $entry_state;
	  }
	}

	tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'");

	tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_id));

	} else if ($error == true) {
	  $cInfo = new objectInfo($HTTP_POST_VARS);
	  $processed = true;
	}

	break;
  case 'deleteconfirm':
	$customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);

	if (isset($HTTP_POST_VARS['delete_reviews']) && ($HTTP_POST_VARS['delete_reviews'] == 'on')) {
	  $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 . "'");
	} else {
	  tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null 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 . "'");

	tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action'))));
	break;
  default:
	$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");
	$customers = tep_db_fetch_array($customers_query);
	$cInfo = new objectInfo($customers);
}
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
<?php
 if ($action == 'edit' || $action == 'update') {
?>
<script language="javascript"><!--

function check_form() {
 var error = 0;
 var error_message = "<?php echo JS_ERROR; ?>";

 var customers_firstname = document.customers.customers_firstname.value;
 var customers_lastname = document.customers.customers_lastname.value;
<?php if (ACCOUNT_COMPANY == 'true') echo 'var entry_company = document.customers.entry_company.value;' . "\n"; ?>
<?php if (ACCOUNT_DOB == 'true') echo 'var customers_dob = document.customers.customers_dob.value;' . "\n"; ?>
 var customers_email_address = document.customers.customers_email_address.value;
 var entry_street_address = document.customers.entry_street_address.value;
 var entry_postcode = document.customers.entry_postcode.value;
 var entry_city = document.customers.entry_city.value;
 var customers_telephone = document.customers.customers_telephone.value;

<?php if (ACCOUNT_GENDER == 'true') { ?>
 if (document.customers.customers_gender[0].checked || document.customers.customers_gender[1].checked) {
 } else {
error_message = error_message + "<?php echo JS_GENDER; ?>";
error = 1;
 }
<?php } ?>

 if (customers_firstname == "" || customers_firstname.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_FIRST_NAME; ?>";
error = 1;
 }

 if (customers_lastname == "" || customers_lastname.length < <?php echo ENTRY_LAST_NAME_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_LAST_NAME; ?>";
error = 1;
 }

<?php if (ACCOUNT_DOB == 'true') { ?>
 if (customers_dob == "" || customers_dob.length < <?php echo ENTRY_DOB_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_DOB; ?>";
error = 1;
 }
<?php } ?>

 if (customers_email_address == "" || customers_email_address.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_EMAIL_ADDRESS; ?>";
error = 1;
 }

 if (entry_street_address == "" || entry_street_address.length < <?php echo ENTRY_STREET_ADDRESS_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_ADDRESS; ?>";
error = 1;
 }

 if (entry_postcode == "" || entry_postcode.length < <?php echo ENTRY_POSTCODE_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_POST_CODE; ?>";
error = 1;
 }

 if (entry_city == "" || entry_city.length < <?php echo ENTRY_CITY_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_CITY; ?>";
error = 1;
 }

<?php
 if (ACCOUNT_STATE == 'true') {
?>
 if (document.customers.elements['entry_state'].type != "hidden") {
if (document.customers.entry_state.value == '' || document.customers.entry_state.value.length < <?php echo ENTRY_STATE_MIN_LENGTH; ?> ) {
   error_message = error_message + "<?php echo JS_STATE; ?>";
   error = 1;
}
 }
<?php
 }
?>

 if (document.customers.elements['entry_country_id'].type != "hidden") {
if (document.customers.entry_country_id.value == 0) {
  error_message = error_message + "<?php echo JS_COUNTRY; ?>";
  error = 1;
}
 }

 if (customers_telephone == "" || customers_telephone.length < <?php echo ENTRY_TELEPHONE_MIN_LENGTH; ?>) {
error_message = error_message + "<?php echo JS_TELEPHONE; ?>";
error = 1;
 }

 if (error == 1) {
alert(error_message);
return false;
 } else {
return true;
 }
}
//--></script>
<?php
 }
?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 if ($action == 'edit' || $action == 'update') {
$newsletter_array = array(array('id' => '1', 'text' => ENTRY_NEWSLETTER_YES),
						  array('id' => '0', 'text' => ENTRY_NEWSLETTER_NO));
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr><?php echo tep_draw_form('customers', FILENAME_CUSTOMERS, tep_get_all_get_params(array('action')) . 'action=update', 'post', 'onSubmit="return check_form();"') . tep_draw_hidden_field('default_address_id', $cInfo->customers_default_address_id); ?>
	<td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td>
  </tr>
  <tr>
	<td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
<?php
if (ACCOUNT_GENDER == 'true') {
?>
	  <tr>
		<td class="main"><?php echo ENTRY_GENDER; ?></td>
		<td class="main">
<?php
if ($error == true) {
  if ($entry_gender_error == true) {
	echo tep_draw_radio_field('customers_gender', 'm', false, $cInfo->customers_gender) . '  ' . MALE . '  ' . tep_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . '  ' . FEMALE . ' ' . ENTRY_GENDER_ERROR;
  } else {
	echo ($cInfo->customers_gender == 'm') ? MALE : FEMALE;
	echo tep_draw_hidden_field('customers_gender');
  }
} else {
  echo tep_draw_radio_field('customers_gender', 'm', false, $cInfo->customers_gender) . '  ' . MALE . '  ' . tep_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . '  ' . FEMALE;
}
?></td>
	  </tr>
<?php
}
?>
	  <tr>
		<td class="main"><?php echo ENTRY_FIRST_NAME; ?></td>
		<td class="main">
<?php
 if ($error == true) {
if ($entry_firstname_error == true) {
  echo tep_draw_input_field('customers_firstname', $cInfo->customers_firstname, 'maxlength="32"') . ' ' . ENTRY_FIRST_NAME_ERROR;
} else {
  echo $cInfo->customers_firstname . tep_draw_hidden_field('customers_firstname');
}
 } else {
echo tep_draw_input_field('customers_firstname', $cInfo->customers_firstname, 'maxlength="32"', true);
 }
?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo ENTRY_LAST_NAME; ?></td>
		<td class="main">
<?php
 if ($error == true) {
if ($entry_lastname_error == true) {
  echo tep_draw_input_field('customers_lastname', $cInfo->customers_lastname, 'maxlength="32"') . ' ' . ENTRY_LAST_NAME_ERROR;
} else {
  echo $cInfo->customers_lastname . tep_draw_hidden_field('customers_lastname');
}
 } else {
echo tep_draw_input_field('customers_lastname', $cInfo->customers_lastname, 'maxlength="32"', true);
 }
?></td>
	  </tr>
<?php
if (ACCOUNT_DOB == 'true') {
?>
	  <tr>
		<td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
		<td class="main">

<?php
if ($error == true) {
  if ($entry_date_of_birth_error == true) {
	echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"') . ' ' . ENTRY_DATE_OF_BIRTH_ERROR;
  } else {
	echo $cInfo->customers_dob . tep_draw_hidden_field('customers_dob');
  }
} else {
  echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"', true);
}
?></td>
	  </tr>
<?php
}
?>
	  <tr>
		<td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
		<td class="main">
<?php
 if ($error == true) {
if ($entry_email_address_error == true) {
  echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR;
} elseif ($entry_email_address_check_error == true) {
  echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
} elseif ($entry_email_address_exists == true) {
  echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS;
} else {
  echo $customers_email_address . tep_draw_hidden_field('customers_email_address');
}
 } else {
echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"', true);
 }
?></td>
	  </tr>
	</table></td>
  </tr>
<?php
if (ACCOUNT_COMPANY == 'true') {
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td class="formAreaTitle"><?php echo CATEGORY_COMPANY; ?></td>
  </tr>
  <tr>
	<td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
	  <tr>
		<td class="main"><?php echo ENTRY_COMPANY; ?></td>
		<td class="main">
<?php
if ($error == true) {
  if ($entry_company_error == true) {
	echo tep_draw_input_field('entry_company', $cInfo->entry_company, 'maxlength="32"') . ' ' . ENTRY_COMPANY_ERROR;
  } else {
	echo $cInfo->entry_company . tep_draw_hidden_field('entry_company');
  }
} else {
  echo tep_draw_input_field('entry_company', $cInfo->entry_company, 'maxlength="32"');
}
?></td>
	  </tr>
	</table></td>
  </tr>
<?php
}
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td class="formAreaTitle"><?php echo CATEGORY_ADDRESS; ?></td>
  </tr>
  <tr>
	<td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
	  <tr>
		<td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td>
		<td class="main">
<?php
 if ($error == true) {
if ($entry_street_address_error == true) {
  echo tep_draw_input_field('entry_street_address', $cInfo->entry_street_address, 'maxlength="64"') . ' ' . ENTRY_STREET_ADDRESS_ERROR;
} else {
  echo $cInfo->entry_street_address . tep_draw_hidden_field('entry_street_address');
}
 } else {
echo tep_draw_input_field('entry_street_address', $cInfo->entry_street_address, 'maxlength="64"', true);
 }
?></td>
	  </tr>
<?php
if (ACCOUNT_SUBURB == 'true') {
?>
	  <tr>
		<td class="main"><?php echo ENTRY_SUBURB; ?></td>
		<td class="main">
<?php
if ($error == true) {
  if ($entry_suburb_error == true) {
	echo tep_draw_input_field('suburb', $cInfo->entry_suburb, 'maxlength="32"') . ' ' . ENTRY_SUBURB_ERROR;
  } else {
	echo $cInfo->entry_suburb . tep_draw_hidden_field('entry_suburb');
  }
} else {
  echo tep_draw_input_field('entry_suburb', $cInfo->entry_suburb, 'maxlength="32"');
}
?></td>
	  </tr>
<?php
}
?>
	  <tr>
		<td class="main"><?php echo ENTRY_POST_CODE; ?></td>
		<td class="main">
<?php
 if ($error == true) {
if ($entry_post_code_error == true) {
  echo tep_draw_input_field('entry_postcode', $cInfo->entry_postcode, 'maxlength="8"') . ' ' . ENTRY_POST_CODE_ERROR;
} else {
  echo $cInfo->entry_postcode . tep_draw_hidden_field('entry_postcode');
}
 } else {
echo tep_draw_input_field('entry_postcode', $cInfo->entry_postcode, 'maxlength="8"', true);
 }
?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo ENTRY_CITY; ?></td>
		<td class="main">
<?php
 if ($error == true) {
if ($entry_city_error == true) {
  echo tep_draw_input_field('entry_city', $cInfo->entry_city, 'maxlength="32"') . ' ' . ENTRY_CITY_ERROR;
} else {
  echo $cInfo->entry_city . tep_draw_hidden_field('entry_city');
}
 } else {
echo tep_draw_input_field('entry_city', $cInfo->entry_city, 'maxlength="32"', true);
 }
?></td>
	  </tr>
<?php
if (ACCOUNT_STATE == 'true') {
?>
	  <tr>
		<td class="main"><?php echo ENTRY_STATE; ?></td>
		<td class="main">
<?php
$entry_state = tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state);
if ($error == true) {
  if ($entry_state_error == 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 = '" . tep_db_input($cInfo->entry_country_id) . "' 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('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR;
	} else {
	  echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)) . ' ' . ENTRY_STATE_ERROR;
	}
  } else {
	echo $entry_state . tep_draw_hidden_field('entry_zone_id') . tep_draw_hidden_field('entry_state');
  }
} else {
  echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state));
}

?></td>
	 </tr>
<?php
}
?>
	  <tr>
		<td class="main"><?php echo ENTRY_COUNTRY; ?></td>
		<td class="main">
<?php
 if ($error == true) {
if ($entry_country_error == true) {
  echo tep_draw_pull_down_menu('entry_country_id', tep_get_countries(), $cInfo->entry_country_id) . ' ' . ENTRY_COUNTRY_ERROR;
} else {
  echo tep_get_country_name($cInfo->entry_country_id) . tep_draw_hidden_field('entry_country_id');
}
 } else {
echo tep_draw_pull_down_menu('entry_country_id', tep_get_countries(), $cInfo->entry_country_id);
 }
?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td class="formAreaTitle"><?php echo CATEGORY_CONTACT; ?></td>
  </tr>
  <tr>
	<td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
	  <tr>
		<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
		<td class="main">
<?php
 if ($error == true) {
if ($entry_telephone_error == true) {
  echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"') . ' ' . ENTRY_TELEPHONE_NUMBER_ERROR;
} else {
  echo $cInfo->customers_telephone . tep_draw_hidden_field('customers_telephone');
}
 } else {
echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"', true);
 }
?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td>
		<td class="main">
<?php
 if ($processed == true) {
echo $cInfo->customers_fax . tep_draw_hidden_field('customers_fax');
 } else {
echo tep_draw_input_field('customers_fax', $cInfo->customers_fax, 'maxlength="32"');
 }
?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td class="formAreaTitle"><?php echo CATEGORY_OPTIONS; ?></td>
  </tr>
  <tr>
	<td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
	  <tr>
		<td class="main"><?php echo ENTRY_NEWSLETTER; ?></td>
		<td class="main">
<?php
 if ($processed == true) {
if ($cInfo->customers_newsletter == '1') {
  echo ENTRY_NEWSLETTER_YES;
} else {
  echo ENTRY_NEWSLETTER_NO;
}
echo tep_draw_hidden_field('customers_newsletter');
 } else {
echo tep_draw_pull_down_menu('customers_newsletter', $newsletter_array, (($cInfo->customers_newsletter == '1') ? '1' : '0'));
 }
?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td align="right" class="main"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('action'))) .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
  </tr></form>
<?php
 } else {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr><?php echo tep_draw_form('search', FILENAME_CUSTOMERS, '', 'get'); ?>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search'); ?></td>
	  </form></tr>
	</table></td>
  </tr>

<?php

if($action == 'confirm') {
echo '<tr><td width="100%"><div class="messageStackWarning" style="margin: 1em 0; padding: 5px;"><b>' . TEXT_INFO_HEADING_DELETE_CUSTOMER .
'</b><br> '. TEXT_DELETE_CUSTOMER . ' <b> ' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname.'</b> <a class="splitPageLink" href="' .
tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=deleteconfirm') .
'">' . TEXT_DELETE_ACCOUNT . '</a> / <a class="splitPageLink" href="' .
tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action'))) .
'">' . TEXT_DELETE_ACCOUNT_CANCEL . '</a></div></td></tr>';
}
/*
Function to print table headers based on current sort pattern
$name = Full name of header, usually defined in language files
$id = sort word used in URL
$current_dir = current sort direction (ASC or DESC)
*/
function print_sort( $name, $id, $default_sort ) {
global $orderby, $sort;

if( isset( $orderby ) && ( $orderby == $id ) ) {
	if( $sort == 'ASC' ) {
		$to_sort = 'DESC';
	} else {
		$to_sort = 'ASC';
	}
} else {
	$to_sort = $default_sort;
}
$return = '<a href="' . tep_href_link(FILENAME_CUSTOMERS, 'orderby=' . $id . '&sort='. $to_sort) .
'" class="headerLink">' . $name . '</a>';
if( $orderby == $id ) {
	$return .= ' <img src="images/arrow_' . ( ( $to_sort == 'DESC' ) ? 'down' : 'up' ) .
	'.png" width="10" height="13" border="0" alt="" />';
}
return $return;
}
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ACTIONS; ?></td>
			<td class="dataTableHeadingContent" nowrap><?php echo print_sort(TABLE_HEADING_LASTNAME, 'lastname', 'ASC'); ?></td>
			<td class="dataTableHeadingContent" nowrap><?php echo print_sort(TABLE_HEADING_FIRSTNAME, 'firstname', 'ASC'); ?></td>
			<td class="dataTableHeadingContent" align="center"><?php echo print_sort(TABLE_HEADING_ACCOUNT_CREATED, 'date_created', 'DESC'); ?></td>
			<td class="dataTableHeadingContent" align="center"><?php echo print_sort(TABLE_HEADING_LAST_LOGIN, 'date_login', 'DESC'); ?></td>
			<td class="dataTableHeadingContent" align="center"><?php echo print_sort(TABLE_HEADING_NUM_LOGINS, 'num_logins', 'DESC'); ?></td>
			<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_TELEPHONE; ?></td>
			<td class="dataTableHeadingContent" align="center"><?php echo print_sort(TABLE_HEADING_LOCATION, 'state', 'ASC'); ?></td>
			<td class="dataTableHeadingContent" align="center"><?php //DL BEGIN
			echo print_sort(TABLE_HEADING_NEWSLETTER, 'newsletter', 'ASC'); 
			//DL END 
			?>	</td>
		  </tr>
<?php

$search = '';

// Setup column sorting
if($orderby == 'lastname') {
$db_orderby = 'c.customers_lastname ' . $sort . ', c.customers_firstname';
} elseif($orderby == 'firstname') {
$db_orderby = 'c.customers_firstname ' . $sort . ', c.customers_lastname';
} elseif($orderby == 'date_created') {
$db_orderby = 'date_account_created ' . $sort . ', c.customers_lastname';
} elseif($orderby == 'date_login') {
$db_orderby = 'last_logon ' . $sort . ', c.customers_lastname';
} elseif($orderby == 'num_logins') {
$db_orderby = 'num_logons ' . $sort . ', c.customers_lastname';
} elseif($orderby == 'dob') {
$db_orderby = 'customers_dob ' . $sort . ', c.customers_lastname';
} elseif($orderby == 'state') {
$db_orderby = 'country ' . $sort . ', state ' . $sort . ', city ' . $sort . ', c.customers_lastname';
//DL BEGIN
} elseif($orderby == 'newsletter ') {
$db_orderby = 'c.customers_newsletter ASC, date_account_created';	
} else {
$db_orderby = 'c.customers_newsletter ' . $sort . ', date_account_created';
}
//DL END
if(!$sort) $sort = 'ASC';

if (isset($HTTP_GET_VARS['search']) && tep_not_null($HTTP_GET_VARS['search'])) {
  $keywords = tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['search']));
  $search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%'";
}
//DL BEGIN - Fix from 1.4.2 package
$customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_telephone, c.customers_dob, ci.customers_info_date_of_last_logon as last_logon, ci.customers_info_number_of_logons as num_logons, ci.customers_info_date_account_created as date_account_created, a.entry_city as city, a.entry_state as state_alt, z.zone_name as state, ctry.countries_iso_code_2 as country, c.customers_newsletter, a.entry_country_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id left join " . TABLE_CUSTOMERS_INFO . " ci on c.customers_id = ci.customers_info_id left join " . TABLE_COUNTRIES . " ctry on a.entry_country_id = ctry.countries_id left join " . TABLE_ZONES . " z on a.entry_zone_id = z.zone_id " . $search . " order by " . $db_orderby . " " . $sort; 
$customers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows);
$customers_query = tep_db_query($customers_query_raw);
while ($customers = tep_db_fetch_array($customers_query)) {
//DL END
  $info_query = tep_db_query("select customers_info_date_account_created as date_account_created, customers_info_date_account_last_modified as date_account_last_modified, customers_info_date_of_last_logon as date_last_logon, customers_info_number_of_logons as number_of_logons from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers['customers_id'] . "'");
  $info = tep_db_fetch_array($info_query);

  if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $customers['customers_id']))) && !isset($cInfo)) {
	$country_query = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$customers['entry_country_id'] . "'");
	$country = tep_db_fetch_array($country_query);

	$reviews_query = tep_db_query("select count(*) as number_of_reviews from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers['customers_id'] . "'");
	$reviews = tep_db_fetch_array($reviews_query);

	$customer_info = array_merge($country, $info, $reviews);

	$cInfo_array = array_merge($customers, $customer_info);
	$cInfo = new objectInfo($cInfo_array);
  }
?>
<tr class="dataTableRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)">
<td><?php echo
'<a href="' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) .
'cID=' . $customers['customers_id'] . '&action=edit') . '">' . tep_image(DIR_WS_IMAGES . 'edit.png', IMAGE_EDIT) . '</a> | <a href="' .
tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) .
'cID=' . $customers['customers_id'] . '&action=confirm') . '">' . tep_image(DIR_WS_IMAGES . 'delete.png', IMAGE_DELETE) . '</a> | <a href="' .
tep_href_link(FILENAME_ORDERS, 'cID=' . $customers['customers_id']) . '">' . tep_image(DIR_WS_IMAGES . 'orders.png', IMAGE_ORDERS) . '</a> | <a href="' .
tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $customers['customers_email_address']) . '">' . tep_image(DIR_WS_IMAGES . 'email_send.png', IMAGE_EMAIL) . '</a>';
?></td>
			<td class="dataTableContent"><?php echo ucwords($customers['customers_lastname']); ?></td>
			<td class="dataTableContent"><?php echo ucwords($customers['customers_firstname']); ?></td>
			<td class="dataTableContent" align="center"><?php echo tep_date_short($customers['date_account_created']); ?></td>
			<td class="dataTableContent" align="center"><?php echo tep_date_short($info['date_last_logon']); ?></td>
			<td class="dataTableContent" align="center"><?php echo ($info['number_of_logons']); ?></td>
			<td class="dataTableContent"><?php echo $customers['customers_telephone']; ?></td>
	<td class="dataTableContent"><?php
	echo ($customers['country'] ? $customers['country'] : '<font color="#808080">TEXT_NONE</font>') . ', ';
	if( isset($customers['state']) ) {
		echo ucwords($customers['state']);
	} else if( ! empty($customers['state_alt']) ) {
		echo ucwords($customers['state_alt']);
	} else {
		echo '<font color="#808080">TEXT_NONE</font>';
	}
	echo ', ' . ucwords(($customers['city'] ? $customers['city'] : '<font color="#808080">TEXT_NONE</font>')); ?></td>
	<td class="dataTableContent"><div align="center">
		<?php   if ($customers['customers_newsletter'] > '0') {
  echo '<font color="#00CC33"><strong>' . ENTRY_NEWSLETTER_YES . '</strong></font>';
} else {
  echo '<font color="#FF0000"><strong>' . ENTRY_NEWSLETTER_NO . '</strong></font>';
}?>
	</div></td>
<?php
}
?>
		  <tr>
			<td colspan="10"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>
				<td class="smallText" align="right"><?php echo $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td>
			  </tr>
<?php
if (isset($HTTP_GET_VARS['search']) && tep_not_null($HTTP_GET_VARS['search'])) {
?>
			  <tr>
				<td align="right" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_CUSTOMERS) . '">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td>
			  </tr>
<?php
}
?>
			</table></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

Tne contribution works fine 100%.

 

Except with application_top.php

 

I have an extrange issue on line 70.

// Set the level of error reporting
error_reporting(E_ALL & ~E_NOTICE);

 

If I change that to:

// Set the level of error reporting
// error_reporting(E_ALL & ~E_NOTICE);

 

The contribution gives extrange errors (..also defined, etc) when clicking on change password box.

 

I dont know why disabling the reporting gives error reportings, and enabling it dont give errors.

 

¿?

Share this post


Link to post
Share on other sites

Hello I just installed the contribution admin password change customers v3.2 from 0 not upgraded and I have the following error:

 

Fatal error: Call to undefined function tep_create_random_value () in catalog / admin / change_password.php on line 127

 

anyone can help me or give any clues?

Share this post


Link to post
Share on other sites

Hello I just installed the contribution admin password change customers v3.2 from 0 not upgraded and I have the following error:

 

Fatal error: Call to undefined function tep_create_random_value () in catalog / admin / change_password.php on line 127

 

anyone can help me or give any clues?

Share this post


Link to post
Share on other sites

hey guys sorry to be a pest, i installed all this as guided on the read me file and now when i try to sign in as admin i get this :

 

Fatal error: Call to undefined function tep_get_version() in /home/content/05/7060605/html/oscommerce/catalog/admin/includes/header.php on line 20

 

i didnt change anything on that file! wierd. does anybody have a clue what should i do?

Thanks

Share this post


Link to post
Share on other sites

The issue with rhe error message has been solved.

 

But the issue of (change my account password) on the store side, is still not an active link. I will keep looking for a solution in mean time. But if someone knows of a post regarding this issue, I would be happy to know of it.

 

Thanks.

 

blr044

 

Any idea how you solved this issue? I'm still receiving the:

 

Fatal error: Cannot redeclare tep_validate_password() (previously declared in /home/xxxxxx/public_html/acquire_wine/xxxxxx/includes/functions/password_funcs.php:16) in /home/xxxxxxx/public_html/acquire_wine/xxxxx/includes/functions/password_funcs.php on line 29

Share this post


Link to post
Share on other sites

Click the "Cannot redeclare..." link in my signature.


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×