[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

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

   1  <?php
   2  /**

   3   * password_funcs functions 

   4   *

   5   * @package functions

   6   * @copyright Copyright 2003-2005 Zen Cart Development Team

   7   * @copyright Portions Copyright 2003 osCommerce

   8   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   9   * @version $Id: password_funcs.php 2618 2005-12-20 00:35:47Z drbyte $

  10   */
  11  
  12  ////

  13  // This function validates a plain text password with an encrpyted password

  14    function zen_validate_password($plain, $encrypted) {
  15      if (zen_not_null($plain) && zen_not_null($encrypted)) {
  16  // split apart the hash / salt

  17        $stack = explode(':', $encrypted);
  18  
  19        if (sizeof($stack) != 2) return false;
  20  
  21        if (md5($stack[1] . $plain) == $stack[0]) {
  22          return true;
  23        }
  24      }
  25  
  26      return false;
  27    }
  28  
  29  ////

  30  // This function makes a new password from a plaintext password. 

  31    function zen_encrypt_password($plain) {
  32      $password = '';
  33  
  34      for ($i=0; $i<10; $i++) {
  35        $password .= zen_rand();
  36      }
  37  
  38      $salt = substr(md5($password), 0, 2);
  39  
  40      $password = md5($salt . $plain) . ':' . $salt;
  41  
  42      return $password;
  43    }
  44  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics