Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

AutoLogon not working


MarkEt

Recommended Posts

I set-up the autologon contrib on my web yesterday, and can't make it work. When I come back I'm not logged-in, however, if I go to the login page, The email field is filled.

 

What is wrong ?

 

I quickly checked and don't seem to have missed any mod.

Link to comment
Share on other sites

Here is the code :

 

<?php

/*

 $Id: password_funcs.php,v 1.10 2003/02/11 01:31:02 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 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;

 }

?>

Link to comment
Share on other sites

So you did miss the correction to this function. It really is in the zipfile.

 

Here is the updated part:

<?php 

/* 

 $Id: password_funcs.php,v 1.10 2003/02/11 01:31:02 hpdl Exp $ 



 osCommerce, Open Source E-Commerce Solutions 

 http://www.oscommerce.com 



 Copyright (c) 2003 osCommerce 



 Released under the GNU General Public License 

*/ 



//// 

// This funstion validates a plain text password with an 

// encrpyted password 

 function tep_validate_password($plain, $encrypted) { 

// HMCS: Begin Autologon	******************************************************************



   global $HTTP_COOKIE_VARS;



   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;

     }

   }

if (tep_not_null($HTTP_COOKIE_VARS['password']) && tep_not_null($encrypted)) {   //Autologon

     if ($HTTP_COOKIE_VARS['password'] == $encrypted) {

    return true;

     }      

}



// HMCS: End Autologon  ******************************************************************

   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; 

 } 

?>

Greetings from Marcel

|Current version|Documentation|Contributions|

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...