Displaying Password

Displaying Password

am 22.12.2009 05:18:30 von Karl DeSaulniers

--Apple-Mail-1--319530840
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

Hello List,
Hope your all ready for the Holidays, I know I am. :)
I have a situation where I want to display a users password as
bullets instead of the actual password characters once read from the
database.
I feel there is a better way than what I am doing. I am trying
str_replace() with a for loop to loop throuth how many characters and
replace each with a bullet when displaying.

Like this:
$replace_count = strlen($UserPassword);

for ($i=0; $i < strlen($UserPassword); $i++) {
$UserPassword = str_replace('a', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('b', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('c', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('d', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('e', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('f', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('g', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('h', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('i', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('j', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('k', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('l', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('m', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('n', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('o', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('p', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('q', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('r', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('s', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('t', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('u', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('v', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('w', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('x', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('y', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('z', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('1', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('2', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('3', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('4', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('5', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('6', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('7', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('8', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('9', '•', $UserPassword, &
$replace_count);
$UserPassword .= str_replace('0', '•', $UserPassword, &
$replace_count);
} //hide pasword

But I keep getting a paramiters error for str_replace.

Warning: Wrong parameter count for str_replace() in blah, blah, blah

Doesn't strlen return a number value?

Thanks in advance.

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--Apple-Mail-1--319530840--