Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function randomPassword() {
- $currentmonth = date('n');
- $fivealphabet = "ABCDEFGHIJKLMNOPQRSTUWXYZ";
- $tenalphabet = "ZYXWVUTSRQPONMLKJIHGFDCBA";
- $random = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
- $five = array();
- $ten = array();
- $alphaLength = strlen($random) - 1;
- for ($i = 0; $i < 15; $i++) {
- $n = rand(0, $alphaLength);
- $five[] = $random[$n];
- $ten[] = $random[$n];
- }
- $five[4] = substr($fivealphabet, $currentmonth - 1, 1);
- $ten[9] = substr($tenalphabet, $currentmonth - 1, 1);
- $last[14]= substr($tenalphabet, $currentmonth - 1, 1);
- $newpassword = implode(array_merge($five, $ten, $last));
- $user = '1';
- // New password for the user in plaintext
- $new_pass = 'Testing';
- // NOTICE! Unable to login with Random Password?
- reset_password($user, $newpassword);
- // NOTICE! For The Testing Purpose It Is Working?
- reset_password($user, $new_pass);
- return $newpassword;
- }
Add Comment
Please, Sign In to add comment