Guest User

Untitled

a guest
Jan 15th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. function randomPassword() {
  2. $currentmonth = date('n');
  3. $fivealphabet = "ABCDEFGHIJKLMNOPQRSTUWXYZ";
  4. $tenalphabet = "ZYXWVUTSRQPONMLKJIHGFDCBA";
  5. $random = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
  6. $five = array();
  7. $ten = array();
  8.  
  9. $alphaLength = strlen($random) - 1;
  10. for ($i = 0; $i < 15; $i++) {
  11. $n = rand(0, $alphaLength);
  12. $five[] = $random[$n];
  13. $ten[] = $random[$n];
  14.  
  15. }
  16. $five[4] = substr($fivealphabet, $currentmonth - 1, 1);
  17. $ten[9] = substr($tenalphabet, $currentmonth - 1, 1);
  18. $last[14]= substr($tenalphabet, $currentmonth - 1, 1);
  19.  
  20. $newpassword = implode(array_merge($five, $ten, $last));
  21.  
  22. $user = '1';
  23.  
  24. // New password for the user in plaintext
  25. $new_pass = 'Testing';
  26.  
  27. // NOTICE! Unable to login with Random Password?
  28. reset_password($user, $newpassword);
  29.  
  30. // NOTICE! For The Testing Purpose It Is Working?
  31. reset_password($user, $new_pass);
  32.  
  33.  
  34. return $newpassword;
  35.  
  36. }
Add Comment
Please, Sign In to add comment