Guest User

test

a guest
Aug 6th, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. function CodiceRandom() {
  2.         $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
  3.         $pass = array(); //remember to declare $pass as an array
  4.         $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
  5.         $n = rand(26, 51); 
  6.         $pass[] = $alphabet[$n];
  7.         for ($i = 0; $i < 6; $i++) {
  8.             $n = rand(0, $alphaLength);
  9.             $pass[] = $alphabet[$n];
  10.         }
  11.         $n = rand(52, $alphaLength);   
  12.         $pass[] = $alphabet[$n];
  13.         return implode($pass); //turn the array into a string
  14.     }
Add Comment
Please, Sign In to add comment