Guest User

Untitled

a guest
Apr 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. include 'test.php';
  3. $t = Token::gen(10);
  4. echo $t;
  5. echo "n";
  6.  
  7. <?php
  8. class Token {
  9. public static function gen($len = 5)
  10. {
  11. $token = '';
  12. while($len--){
  13. $choose = rand(0, 2);
  14. if ($choose === 0)
  15. $token .= chr(rand(ord('A'), ord('Z')));
  16. else if($choose === 1)
  17. $token .= chr(rand(ord('a'), ord('z')));
  18. else
  19. $token .= chr(rand(ord('0'), ord('9')));
  20. }
  21. return $token;
  22. }
  23.  
  24. }
  25.  
  26. > php.exe .t1.php
  27. 308AXoL3zs
  28. > php.exe .t1.php
  29. g18tZZHgv3
  30. > php.exe .t1.php
  31. Chk7ir55g4
  32. > php.exe .t1.php
  33. 33oRvjqqYf
Add Comment
Please, Sign In to add comment