Left Quote    Treat your password like your toothbrush. Don't let anybody else use it, and get a new one every six months.
- Clifford Stoll    
Right Quote
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply

        Viewing Topic: Help with Password Generator
  This user is offline  sjotto
  Subject: "Help with Password Generator" Posted: @ 6:50 pm on Apr 03 2008   
Member #: 649
Rank: User - (5)
Since: 03/30/08
Posts: 5

//set the random id length
$random_id_leng th = 10;

//generate a random id encrypt it and store it in $rnd_id
$rnd_id = crypt(uniqid(ra nd(),1));

//to remove any slashes that might have come
$rnd_id = strip_tags(stri pslashes($rnd_i d));

//Removing any . or / and reversing the string
$rnd_id = str_replace(&qu ot;.",&quo t;",$rnd_i d);
$rnd_id = strrev(str_repl ace("/&quo t;,"" ,$rnd_id));

//finally I take the first 10 characters from the $rnd_id
$rnd_id = substr($rnd_id, 0,$random_id_le ngth);

echo "Random Id: $rnd_id";< br /> ?>

One outcome from this script make this password: 041TbPATvW

Can someone help me remove the capitals letters from the script dont show in the password.

And I want to give my users some choises, that they can choose number, letters. Or a combination like the code above

sry language and grammar mistakes.

    Viewed: 3,915 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Help with Password Generator" Posted: @ 6:05 pm on Apr 04 2008    

Member #: 1
Rank: Admin. - (1,508)
Since: 02/06/05
Posts: 602
From: USA

So you want the caps to be lower case? What about using strtolower(); Or do you want capital letters removed from the password? If so, you might need to use regular expressions (regex) to detect an upper case letter and replace it with "" (null/blank/not hing).

-bs0d |

    Viewed: 3,897 Times | Reply to This | To top
Viewing Page: 1 of 1

1 |

You must be logged in to post on the forums. Login or Register

"" Copyright © 2002-2020; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank