| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:13:40 2008 ] | [ osCommRes 1.2.0 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 4 osCommerce, Open Source E-Commerce Solutions 5 http://www.oscommerce.com 6 7 Copyright (c) 2003 osCommerce 8 9 osCommRes, Services Online 10 http://www.oscommres.com 11 12 Copyright (c) 2005 osCommRes 13 14 Released under the GNU General Public License 15 */ 16 //// 17 // This funstion validates a plain text password with an 18 // encrpyted password 19 function tep_validate_password($plain, $encrypted) { 20 if (tep_not_null($plain) && tep_not_null($encrypted)) { 21 // split apart the hash / salt 22 $stack = explode(':', $encrypted); 23 24 if (sizeof($stack) != 2) return false; 25 26 if (md5($stack[1] . $plain) == $stack[0]) { 27 return true; 28 } 29 } 30 31 return false; 32 } 33 34 //// 35 // This function makes a new password from a plaintext password. 36 function tep_encrypt_password($plain) { 37 $password = ''; 38 39 for ($i=0; $i<10; $i++) { 40 $password .= tep_rand(); 41 } 42 43 $salt = substr(md5($password), 0, 2); 44 45 $password = md5($salt . $plain) . ':' . $salt; 46 47 return $password; 48 } 49 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |