Guest User

Strong Password Generator PHP Script - saikrishnadeep.com

a guest
Dec 12th, 2013
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <html>
  2. <title> Password Generator</title>
  3. <body>
  4. <form method="post" action="<?php echo $php_self ?>">
  5. <input type="text" name="length" value="14" >
  6. <input type="submit" name="Submit" value="Generate">
  7. </form>
  8.  
  9. <?php
  10. $char = "!@#$%^&*()_+`-={}|:<>?[]\;',./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  11. $lngth = strlen($char);
  12. $gnLen = $_POST['length'];
  13.  
  14. if ($gnLen <= 100) {
  15. $mArr = str_split($char);
  16. for ($i = 1; $i <= $gnLen; $i++) {
  17. echo $mArr[mt_rand(0,$lngth)];
  18.  }
  19. }
  20. else {
  21. echo "Please enter a number between '1 and 100'";
  22. }
  23. ?>
  24. </body>
  25. </html>
Add Comment
Please, Sign In to add comment