[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/includes/functions/ -> password_funcs.php (source)

   1  <?php
   2  /*
   3    $Id: password_funcs.php,v 1.10 2003/02/11 01:31:02 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13  ////
  14  // This funstion validates a plain text password with an
  15  // encrpyted password
  16    function tep_validate_password($plain, $encrypted) {
  17      if (tep_not_null($plain) && tep_not_null($encrypted)) {
  18  // split apart the hash / salt
  19        $stack = explode(':', $encrypted);
  20  
  21        if (sizeof($stack) != 2) return false;
  22  
  23        if (md5($stack[1] . $plain) == $stack[0]) {
  24          return true;
  25        }
  26      }
  27  
  28      return false;
  29    }
  30  
  31  ////
  32  // This function makes a new password from a plaintext password. 
  33    function tep_encrypt_password($plain) {
  34      $password = '';
  35  
  36      for ($i=0; $i<10; $i++) {
  37        $password .= tep_rand();
  38      }
  39  
  40      $salt = substr(md5($password), 0, 2);
  41  
  42      $password = md5($salt . $plain) . ':' . $salt;
  43  
  44      return $password;
  45    }
  46  ?>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics