Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <?php
  2. function create_password($length=8,$use_upper=1,$use_lower=1,$use_number=1,$use_custom="") {
  3. $upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  4. $lower = "abcdefghijklmnopqrstuvwxyz";
  5. $number = "0123456789";
  6. if($use_upper) {
  7. $seed_length += 26;
  8. $seed .= $upper;
  9. }
  10. if($use_lower) {
  11. $seed_length += 26;
  12. $seed .= $lower;
  13. }
  14. if($use_number) {
  15. $seed_length += 10;
  16. $seed .= $number;
  17. }
  18. if($use_custom) {
  19. $seed_length +=strlen($use_custom);
  20. $seed .= $use_custom;
  21. }
  22. for($x=1;$x<=$length;$x++) {
  23. $password .= $seed{rand(0,$seed_length-1)};
  24. }
  25. print("Your recomended password is: ");
  26. return($password);
  27. }
  28. ?>
  29. <HTML>
  30. <HEAD>
  31. <TITLE>HTML Form</TITLE>
  32. </HEAD>
  33. <BODY>
  34. <FORM ACTION="create_user.php" METHOD="POST">
  35. Username:
  36. <INPUT TYPE="TEXT"
  37. NAME="Array[Username]"
  38. SIZE="20"><BR>
  39. First Name:
  40. <INPUT TYPE="TEXT"
  41. NAME="Array[FirstName]"
  42. SIZE="20"><BR>
  43. Last Name:
  44. <INPUT TYPE="TEXT"
  45. NAME="Array[LastName]"
  46. SIZE="40"><BR>
  47. Email Address:
  48. <INPUT TYPE="TEXT"
  49. NAME="Array[Email]"
  50. SIZE="60"><BR>
  51. <?php
  52. $password = create_password();
  53. echo $password;
  54. ?><BR>
  55. Password:
  56. <INPUT TYPE="PASSWORD"
  57. NAME="Array[Password]"
  58. SIZE="8"><BR>
  59. <INPUT TYPE="SUBMIT"
  60. NAME="SUBMIT"
  61. VALUE="Submit!">
  62. <INPUT TYPE="HIDDEN"
  63. NAME="Password"
  64. VALUE="<?php echo $password; ?>"
  65. SIZE="8">
  66. </FORM>
  67. </BODY>
  68. </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement