Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function create_password($length=8,$use_upper=1,$use_lower=1,$use_number=1,$use_custom="") {
- $upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $lower = "abcdefghijklmnopqrstuvwxyz";
- $number = "0123456789";
- if($use_upper) {
- $seed_length += 26;
- $seed .= $upper;
- }
- if($use_lower) {
- $seed_length += 26;
- $seed .= $lower;
- }
- if($use_number) {
- $seed_length += 10;
- $seed .= $number;
- }
- if($use_custom) {
- $seed_length +=strlen($use_custom);
- $seed .= $use_custom;
- }
- for($x=1;$x<=$length;$x++) {
- $password .= $seed{rand(0,$seed_length-1)};
- }
- print("Your recomended password is: ");
- return($password);
- }
- ?>
- <HTML>
- <HEAD>
- <TITLE>HTML Form</TITLE>
- </HEAD>
- <BODY>
- <FORM ACTION="create_user.php" METHOD="POST">
- Username:
- <INPUT TYPE="TEXT"
- NAME="Array[Username]"
- SIZE="20"><BR>
- First Name:
- <INPUT TYPE="TEXT"
- NAME="Array[FirstName]"
- SIZE="20"><BR>
- Last Name:
- <INPUT TYPE="TEXT"
- NAME="Array[LastName]"
- SIZE="40"><BR>
- Email Address:
- <INPUT TYPE="TEXT"
- NAME="Array[Email]"
- SIZE="60"><BR>
- <?php
- $password = create_password();
- echo $password;
- ?><BR>
- Password:
- <INPUT TYPE="PASSWORD"
- NAME="Array[Password]"
- SIZE="8"><BR>
- <INPUT TYPE="SUBMIT"
- NAME="SUBMIT"
- VALUE="Submit!">
- <INPUT TYPE="HIDDEN"
- NAME="Password"
- VALUE="<?php echo $password; ?>"
- SIZE="8">
- </FORM>
- </BODY>
- </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement