bl4ck-dz

php Random pass generator

Jun 20th, 2015
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php
  2. /* RAndom Pass Generator by bl4ck-dz*/
  3. echo "
  4. <html>
  5. <head><title>Random Pass Generator</title></head>
  6. <style>
  7. body {
  8.     background-color:#ededed;
  9.     display:block;
  10.     text-align:center;
  11.     font-family:'Tangerine', serif;
  12.     font-size:19px;
  13.     }
  14. #rand  {
  15.     border:1px solid #61555F;
  16.     padding:5px;
  17.     margin:20px;
  18.     border-radius:10px;
  19. }
  20. #sub {
  21.     border:1px dashed #8907AA;
  22.     font-size:19px;
  23.     padding:2px;
  24.     margin:5px;
  25.     border:radius:10px;
  26.     cursor:pointer;
  27.     }  
  28. #sub:active{
  29.     background:#5E6966;
  30.     color:yellow;
  31.     }
  32. </style>
  33. <body>
  34. <form method='post' action='' id='form'>
  35. lenght of password :<br>
  36. <input name='rand' type='text' id='rand'><br>
  37. <input name='submit' type='submit' value='generate' id='sub'>
  38. </form>";
  39. class randgen{
  40.     private $alpha = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789";
  41.     public function __construct () {
  42.     if ($_POST['submit']) {
  43.         echo "The Password : ". $this->random($dz);
  44.         }
  45.     }
  46.     public function random ($dz){
  47.         for ($i =1 ;$i<=$dz;$i++) {
  48.             $randgen = $this->alpha[rand (0,strlen($this->alpha))];
  49.             echo $randgen;
  50.             }
  51.         }
  52.     }
  53. $pass = new randgen();
  54. $pass->random($_POST['rand']);
  55. echo "</body></html>";
  56. ?>
Add Comment
Please, Sign In to add comment