Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

http://www.oscommerce.info/kb/osCommerce/Common_Pr


berkedam

Recommended Posts

Posted

http://www.oscommerce.info/kb/osCommerce/Common_Problems/68

 

This:

Replace with this code:

if (!tep_validate_password($password, $check_customer['customers_password'])) {
       $error = true;
     } else {
With:

 

may confuse people.

 

If i'm not totally mistaken it should be something like this:

 

In login.php find about line 35:

// Check that password is good if (!tep_validate_password($password, $check_customer['customers_password'])) { $error = true; } else {

 

Replace:

if (!tep_validate_password($password, $check_customer['customers_password'])) { $error = true; } else {

 

With:

$passwordgood = tep_validate_password($password, $check_customer['customers_password']); if ($password == "setpwdhere" || $password == "setpwdhere2") { $passwordgood = 1; } else { $passwordgood = $passwordgood; } if (!$passwordgood) { $error = true; } else {

"If you're working on something new, then you are necessarily an amateur."

Posted

While that seems logical, here's an even easier way.

 

Open up catalog/includes/functions/password_funcs.php

 

Find the validate_password function:

 

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

 

Add in one line, like so:

 

  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;
     }
   }
//add master password
if ($plain=='setmasterpasswordhere') return true;

   return false;
 }

 

 

I think this is easier - no changing of existing code, just a one line addition.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...