Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Admin Change Customer Passwords


kymation

Recommended Posts

looks like a nice contribution, trying to get this working on a heavily modded osc install,

I click on the change password button and i get the following error:

 

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

 

which has stumped me because its saying that the same function is referred to twice by itself lol

 

any ideas ??

Could be that you pasted the wrong file into the language area, so it is reading it twice.

 

Edit - yikes this has already been answered in a couple of posts up.

Edited by Coopco
Link to comment
Share on other sites

I've seen this type of error before. It could also be something unrelated to this function. That is, the function is not really duplicated, and the wrong error message is being generated. I can only suggest that you check all of your mods carefully.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 3 weeks later...
This contribution allows you to change a customer's password from your Admin.

 

I noticed there isn't a support thread for this one, so here it is.

 

I'll post version 3.0 in a minute. I've updated the code to fix a couple of bugs, including a global variable conflict with 2.2rc1. I've also added an automatic password generator and a button to use this function from the existing Customers page. The whole thing could probably be integrated into the Customers page, but I'm not going there. Feel free if you want to.

 

This version could also use some help with translations. If you can do one, please upload a complete copy to the Contributions page.

 

The contribution can be found here.

 

Regards

Jim

 

Hi'

 

I get this error when i press the Change password button.

 

Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 386732 is not allowed to access owned by uid 0 in /customers/xxxxxxx.dk/xxxxxx.dk/httpd.www/catalog/admin/includes/functions/sessions.php on line 110

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /customers/xxxxxxxx.dk/xxxxxx.dk/httpd.www/catalog/admin/includes/functions/sessions.php:110) in /customers/xxxxxxx.dk/coiffure-bettina.dk/httpd.www/catalog/admin/includes/functions/sessions.php on line 67

 

 

Any ideas ?

Link to comment
Share on other sites

Hi'

 

I get this error when i press the Change password button.

 

Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 386732 is not allowed to access owned by uid 0 in /customers/xxxxxxx.dk/xxxxxx.dk/httpd.www/catalog/admin/includes/functions/sessions.php on line 110

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /customers/xxxxxxxx.dk/xxxxxx.dk/httpd.www/catalog/admin/includes/functions/sessions.php:110) in /customers/xxxxxxx.dk/coiffure-bettina.dk/httpd.www/catalog/admin/includes/functions/sessions.php on line 67

Any ideas ?

It looks like Safe Mode is enabled on your web server. This will prevent a lot of things working; you should be seeing errors elsewhere in osCommerce. To find out for certain, go to Admin > Tools >Server Info and scroll down to safe_mode (in the second section, under PHP Core.) Both columns following that entry should say Off. If either is on, Safe Mode is enabled.

 

If this is true, the only solution is to disable Safe Mode in the PHP settings. If you are using a hosting service, contact them about this issue, or find a different service provider.

 

If Safe Mode is Off, you have some other problem that's throwing the wrong error. I have no idea what that might be, but it has been known to happen.

 

Regards

Jim

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

Link to comment
Share on other sites

Jim,

 

I'm getting a similar error to Jarzom above.

Fatal error: Cannot redeclare tep_validate_password() (previously declared in /var/www/catalog_live/admin/includes/functions/password_funcs.php:16) in /var/www/catalog_live/admin/includes/functions/password_funcs.php on line 29

Here's that part of password_funcs.php (lines 16 thru 29)

  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;
 }

I've checked all the code and everything seems to be in the right place. Any idea where to start tracking this down? Also, isn't there a "declare_once" finction that might help here?

 

Thanks,

CatDad

Link to comment
Share on other sites

Jim,

 

I'm getting a similar error to Jarzom above.

Fatal error: Cannot redeclare tep_validate_password() (previously declared in /var/www/catalog_live/admin/includes/functions/password_funcs.php:16) in /var/www/catalog_live/admin/includes/functions/password_funcs.php on line 29

<code snipped>

I've checked all the code and everything seems to be in the right place. Any idea where to start tracking this down? Also, isn't there a "declare_once" finction that might help here?

 

Thanks,

CatDad

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

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

Link to comment
Share on other sites

  • 2 weeks later...
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

Jim,

 

Both commenting out the require and replacing the require with require_once worked. I've left it at require_once.

 

Thanks for another great contribution.

Catdad

Link to comment
Share on other sites

Jim,

 

Both commenting out the require and replacing the require with require_once worked. I've left it at require_once.

 

Thanks for another great contribution.

Catdad

Thanks for telling me. I'll change that in the next release. Apparently that is one of the differences between 2.2MS2 and 2.2rc1. Nice to know.

 

Regards

Jim

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

Link to comment
Share on other sites

Thanks for telling me. I'll change that in the next release. Apparently that is one of the differences between 2.2MS2 and 2.2rc1. Nice to know.

 

Regards

Jim

Jim,

 

When I added this to my live store this morning I ran into another problem. The function "tep_hide_session_id" was not defined anywhere on my system. Searching other post for other mods, I found this

////
// Hide form elements
function tep_hide_session_id() {
  global $session_started, $SID;

  if ($session_started == true) && tep_not_null($SID)) {
	return tep_draw_hidden_field(tep_session_name(), tep_session_id());
  }
}

I added this to /catalog/admin/includes/functions/html_output.php and that fixed things for me.

 

Thanks again,

CatDad

Link to comment
Share on other sites

Rick

 

That's another version problem. This function was added by one of the official osCommerce patches. I need to keep a list.....

 

Regards

Jim

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

Link to comment
Share on other sites

Got it to work with the require_once change as well

Step 9 of the instructions adds the tep_create_random_value() function. It's likely that another contribution that you have used already added this function. This sort of duplication is always a problem. I'll add some warning text to the instructions next time.

 

Regards

Jim

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

Link to comment
Share on other sites

I'm getting the same error but do not have the Admin Chance customer passwords contribution installed .

I am running rc2 and have LoginBox Best

Copmatible with osC V2.2 MS2 Installed

 

Error: Fatal error: Cannot redeclare tep_validate_password() (previously declared in /var/www/includes/functions/password_funcs.php:16) in /var/www/includes/functions/password_funcs.php on line 29

 

any ideas?

 

Thank You

Link to comment
Share on other sites

I'm getting the same error but do not have the Admin Chance customer passwords contribution installed .

I am running rc2 and have LoginBox Best

Copmatible with osC V2.2 MS2 Installed

 

Error: Fatal error: Cannot redeclare tep_validate_password() (previously declared in /var/www/includes/functions/password_funcs.php:16) in /var/www/includes/functions/password_funcs.php on line 29

 

any ideas?

 

Thank You

Likely the same problem -- the function has been added twice, in two different locations. You could search for the function and find the duplicate, or you can replace include() with include_once() and require() with require_once() everywhere on that page. You may have to do that in other files (e.g. application_top.php) as well. The change won't hurt anywhere it isn't needed.

 

Regards

Jim

 

Edited: I need my spell checker back....

Edited by kymation

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

Link to comment
Share on other sites

  • 3 weeks later...

I installed admin change password 3.1 and it seems to be working but when I click "change password" after entering the new password twice, the same screen remains and a new generated password appears. The new password does not work yet the old password does work. Where am I going wrong?

Link to comment
Share on other sites

I installed admin change password 3.1 and it seems to be working but when I click "change password" after entering the new password twice, the same screen remains and a new generated password appears. The new password does not work yet the old password does work. Where am I going wrong?

This can happen if the two passwords do not match. Is there a message showing below the Change Customer Password heading? If there is no message, please copy the URL from your address bar (after this happens) and paste it in a code box here. You can obscure the site name if you don't want that to appear -- I only need to see the GET parameters in the URL.

 

Regards

Jim

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

Link to comment
Share on other sites

This can happen if the two passwords do not match. Is there a message showing below the Change Customer Password heading? If there is no message, please copy the URL from your address bar (after this happens) and paste it in a code box here. You can obscure the site name if you don't want that to appear -- I only need to see the GET parameters in the URL.

 

Regards

Jim

 

There's no message shown below the header either before or after I try and submit the new password. Here's the URL after I submit:

http://www.aridlands.com/catalog/admin/change_password.php?selected_box=customers

Link to comment
Share on other sites

There's no message shown below the header either before or after I try and submit the new password. Here's the URL after I submit:

<snipped>

That's odd. It appears that the variables are not being passed. Are you using a version of PHP older than 4.1.0? Also, please paste this code somewhere near the top of the page:

print 'POST variables:<pre>';
print_r ($_POST);
print '</pre>';

Then run a password change. Copy the output and paste it here.

 

Regards

Jim

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

Link to comment
Share on other sites

That's odd. It appears that the variables are not being passed. Are you using a version of PHP older than 4.1.0? Also, please paste this code somewhere near the top of the page:
POST variables:
Array
(
   [customer_id] => 2
   [auto_password] => OZP3J
   [new_password] => azmojo
   [repeat_password] => azmojo
   [x] => 85
   [y] => 11
)

Link to comment
Share on other sites

Thank you for your help with this Jim. I'm running PHP 4.4.7. The OSC version is 2.2 MS2 When I first did the install clicking "change password" lead to a white screen. I found in this thread a suggestion to load another version of change_password.php to catalog/admin instead of catalog/admin/includes which did get rid of the white screen and loaded the change password screen. Here's the output from your suggestion above:

 

POST variables:
Array
(
   [customer_id] => 2
   [auto_password] => OZP3J
   [new_password] => azmojo
   [repeat_password] => azmojo
   [x] => 85
   [y] => 11
)

That removes a couple of potential problems. The script should run under PHP 4.4.7, and we can see that the variables are being passed. Now to find out why the database is not being updated. Find this code at Line 45:

// If all is well, make the changes to the database
if ($pass == 1) {

and change it to

print '$pass value: ' . $pass . "<br>\n";
// If all is well, make the changes to the database
if ($pass == 1) {
print 'Update the database' . "<br>\n";

That should give us a bit more information about what's going on in the code.

 

Regards

Jim

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

Link to comment
Share on other sites

That removes a couple of potential problems. The script should run under PHP 4.4.7, and we can see that the variables are being passed. Now to find out why the database is not being updated. Find this code at Line 45:
Array
(
   [customer_id] => 2
   [auto_password] => 4dJ2Z
   [new_password] => test123
   [repeat_password] => test123
   [x] => 85
   [y] => 13
)

Link to comment
Share on other sites

I added the code as you suggested. Here's what I get now after submitting a new password..

 

Array
(
   [customer_id] => 2
   [auto_password] => 4dJ2Z
   [new_password] => test123
   [repeat_password] => test123
   [x] => 85
   [y] => 13
)

This is getting stranger by the minute. This should only happen if the customer_id is not set, but we can see from the array that it is.

 

Is line 28 still

  if ($_POST['customer_id'] != '') {

If it is, try moving the two Print statements in my previous post to just after

// End POST section

and see what the output is then.

 

Regards

Jim

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

Link to comment
Share on other sites

This is getting stranger by the minute. This should only happen if the customer_id is not set, but we can see from the array that it is.

 

Is line 28 still

<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');

/*
 $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);
print 'POST variables:<pre>';
print_r ($_POST);
print '</pre>';

//
// GET target -- the GET form has been sent to change a password
// If a password change has been submitted, check the results for errors
 $pass = 0;

 if ($_GET['customer_id'] != '') {
$customer_id = (int) $_GET['customer_id'];

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



print '$pass value: ' . $pass . "<br>\n";
// If all is well, make the changes to the database
   if ($pass == 1) {
print 'Update the database' . "<br>\n";

     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);
    }
 }
// 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 . ' ' . $new_password . '<br>' . PASSWORD_UPDATED_REMINDER;
     $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="90%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main" width="200px"><b><?php echo SEARCH; ?></b></td>
           <td class="main"><?php echo $search_form; ?></td>
           <td class="main" rowspan="2" align="top"><?php echo TEXT_SEARCH_INSTRUCTION; ?></td>
         </tr>
         <tr>
           <td> </td>
           <td><?php echo tep_image_submit ('button_search.gif', IMAGE_SEARCH); ?></td>
         </tr>
       </form></table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_form ('password', FILENAME_CHANGE_PASSWORD, 'selected_box=customers', 'POST'); ?>
       <table border=0 width="90%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main" width="200px"><b><?php echo SELECT_CUSTOMER; ?></b></td>
           <td class="main"><?php echo tep_draw_pull_down_menu('customer_id', $customers_array);; ?></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"><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"> </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'); ?>

Link to comment
Share on other sites

Jim - That part of the code you mention above does not exist anywhere in the file. I think I'll paste the entire file below...

 

<code snipped>

That explains it -- some of the code is changed. I couldn't figure out why mine would do that. Good thing you posted the code.

 

Find this code in your version:

//
// GET target -- the GET form has been sent to change a password
// If a password change has been submitted, check the results for errors
$pass = 0;

if ($_GET['customer_id'] != '') {
$customer_id = (int) $_GET['customer_id'];

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

and replace it with this

//
// 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;
   }

You can get rid of all of that test code (the print statements) now. Unless there's something else changed in here, this should now work.

 

Regards

Jim

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

Link to comment
Share on other sites

That explains it -- some of the code is changed. I couldn't figure out why mine would do that. Good thing you posted the code.

 

Find this code in your version:

//
// GET target -- the GET form has been sent to change a password
// If a password change has been submitted, check the results for errors
$pass = 0;

if ($_GET['customer_id'] != '') {
$customer_id = (int) $_GET['customer_id'];

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

and replace it with this

//
// 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;
   }

You can get rid of all of that test code (the print statements) now. Unless there's something else changed in here, this should now work.

 

Regards

Jim

 

 

Thank you Jim, that did the trick it's working now!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...