SHARE
TWEET

Untitled

a guest Nov 19th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function minus(){
  3.     $x=rand(97,122);
  4.     return chr($x);
  5. }
  6. function mayus(){
  7.     $x=rand(65,90);
  8.     return chr($x);
  9. }
  10. function numero(){
  11.     $x=rand(48,57);
  12.     return chr($x);
  13. }
  14. function simbol(){
  15.     $x=rand(35,47);
  16.     return chr($x);
  17. }
  18. $ok=false;
  19. while ($ok==false) {
  20.     $aux=rand(8,12);
  21.     $pwd='';
  22.     for ($i=0; $i<$aux;$i++){
  23.         $j=rand(0,3);
  24.         if ($j==0) {
  25.             $pwd=$pwd . minus();
  26.         }
  27.         if ($j==1) {
  28.             $pwd=$pwd . mayus();
  29.         }
  30.         if ($j==2) {
  31.             $pwd=$pwd . numero();
  32.         }
  33.         if ($j==3) {
  34.             $pwd=$pwd . simbol();
  35.         }
  36.     }
  37.     $ok=false;
  38.     if (preg_match("/[A-Z]{1,}/", $pwd) &&
  39.         preg_match("/[a-z]{1,}/", $pwd) &&
  40.         preg_match("/[0-9]{1,}/", $pwd) &&
  41.         preg_match("/[.'&()+]{1,}/", $pwd)) {
  42.        
  43.         $ok=true;
  44.     }
  45.  
  46. }
  47.  
  48. echo $pwd;
  49.  
  50.  
  51.  
  52.  
  53. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top