Zen Cart Logo
Forums / Fraud Prevention / using zen-cart password in another application

using zen-cart password in another application

Locked

Views: 43

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
6 Jun 2011, 9:46 PM
#1
improper avatar

improper

New Zenner

Join Date:
Jun 2011
Posts:
2
Plugin Contributions:
0

using zen-cart password in another application

I need to use the customer database of zencart for an additional application written in Classic ASP. (don't ask, lol!:P)

I am trying to figure out how to write a login in classic asp that uses the same password validation used by zen-cart.

This article http://customzen.##########################/2010/05/how-zen-cart-encrypts-passwords.html was somewhat helpful.

I found functions in /includes/functions/password_funcs.php and have been testing the validation in a separate file like this:

function zen_validate_password($plain, $encrypted) {
$plain="plainpassword";
$encrypted="encryptedpasswordfromdatabase:12";

if (zen_not_null($plain) && zen_not_null($encrypted)) {

// split apart the hash / salt
$stack = explode(':', $encrypted);
echo 'stack0 '.$stack[0],'<br>';
echo 'stack1 '.$stack[1],'<br>';
echo md5($plain).'<br>';
echo (md5( $plain.$stack[1] )).'<br>';

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

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

echo "false";
return false;
}

But it does not reproduce the password stored in the database. Once I understand how to do that, then I can write equivalent classic asp code. TIA for help.

6 Jun 2011, 10:33 PM
#2
improper avatar

improper

New Zenner

Join Date:
Jun 2011
Posts:
2
Plugin Contributions:
0

Re: using zen-cart password in another application

My bad! I was using the wrong unencrypted password for testing! (blush) It works fine! Will be easy to convert to Classic ASP.