| [ Index ] | osCommerce
Docs :: PHP Cross Reference For osCommerce 2.2 MS2 Provided By OSCdox.com |
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 ?>
title
Description
Body
title
Description
Body
| Generated: Tue Nov 4 23:53:39 2003 | Hosted By :: AABox.com |
Cross-referenced by PHPXref 0.4 |