Advertisement
gnwnade

Untitled

Mar 12th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. function randHash($length) {
  2.     $hash = '';
  3.     if ($length>2) {
  4.       $alphabet = str_split('qwertyuiopasdfghjklzxcvbnm');
  5.       for($i = 0; $i < 2; $i++) {
  6.           $hash .= $alphabet[array_rand($alphabet)];
  7.       }
  8.       $length-=2;
  9.     }
  10.     $alphabet = str_split('qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890');
  11.     for($i = 0; $i < $length; $i++) {
  12.         $hash .= $alphabet[array_rand($alphabet)];
  13.     }
  14.     return $hash;
  15. }
  16.  
  17. $key = md5($_POST['address'] . ' ' . randHash(rand(10, 12)));
  18.  
  19. $_SESSION["key"] = $key;
  20.  
  21. $claim_url .= '&key=' . rawurlencode($key);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement