mike_steinhoff Posted May 25, 2003 Posted May 25, 2003 When a customer requests a new password on my site, it sends them characters that they cannot typ into their computer. Is there a way to change this. I have included the email I received below. A new password was requested from 65.222.108.141. Your new password to 'Karaoke On Fire' is: cC??? Any thoughts ? There is no spoon.
edwing Posted May 26, 2003 Posted May 26, 2003 I had the same problem, and did the following to get some easier random passwords: 1. open catalog/includes/functions/general.php 2. Search for: tep_create_random_value 3. Change the original code from: function tep_create_random_value($length, $type = 'mixed') { if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) return false; $rand_value = ''; while (strlen($rand_value) < $length) { if ($type == 'digits') { $char = tep_rand(0,9); } else { $char = chr(tep_rand(0,255)); } if ($type == 'mixed') { if (eregi('^[a-z0-9]$', $char)) $rand_value .= $char; } elseif ($type == 'chars') { if (eregi('^[a-z]$', $char)) $rand_value .= $char; } elseif ($type == 'digits') { if (ereg('^[0-9]$', $char)) $rand_value .= $char; } } to: function tep_create_random_value($length, $type = 'mixed') { if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) return false; $rand_value = ''; while (strlen($rand_value) < $length) { if ($type == 'digits') { $char = tep_rand(0,9); } else { $char = chr(tep_rand(0,122)); } if ($type == 'mixed') { if (eregi('^[a-z0-9]$', $char)) $rand_value .= $char; } elseif ($type == 'chars') { if (eregi('^[a-z]$', $char)) $rand_value .= $char; } elseif ($type == 'digits') { if (ereg('^[0-9]$', $char)) $rand_value .= $char; } } Note that the only thing I changed is the line: $char = chr(tep_rand(0,255)); into: $char = chr(tep_rand(0,122)); ASCII character 122 is 'z' so now it only searches up to that character in the ASCII table. Hope this helps.
ahwood Posted June 22, 2003 Posted June 22, 2003 This worked for me! Only recently found this issue, and after about 1 minute of searching, this fix worked great. FYI, line from our PHPInfo (in case it mattered): Apache/1.3.27 (Unix) (Red-Hat/Linux) FrontPage/5.0.2.2623 mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26 :) ======================= Andy Wood - Stereo Connection Ontario, Canada =======================
Recommended Posts
Archived
This topic is now archived and is closed to further replies.