Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <title> Password Generator</title>
- <body>
- <form method="post" action="<?php echo $php_self ?>">
- <input type="text" name="length" value="14" >
- <input type="submit" name="Submit" value="Generate">
- </form>
- <?php
- $char = "!@#$%^&*()_+`-={}|:<>?[]\;',./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $lngth = strlen($char);
- $gnLen = $_POST['length'];
- if ($gnLen <= 100) {
- $mArr = str_split($char);
- for ($i = 1; $i <= $gnLen; $i++) {
- echo $mArr[mt_rand(0,$lngth)];
- }
- }
- else {
- echo "Please enter a number between '1 and 100'";
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment