Guest User

Untitled

a guest
Aug 6th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <?php
  2.  
  3. //retrieve our data from POST
  4.  
  5. $account_admin_username = $_POST['account_admin_username'];
  6. $account_admin_password = $_POST['account_admin_password'];
  7.  
  8. function generate_password($length='')
  9. {
  10. $str='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_?/:(){}[]0123456789';
  11. $max=strlen($str);
  12. $length=@round($length);
  13. if(empty($length)){$length=rand(8,12);}
  14. $account_admin_password='';
  15. for($i=0; $i<$length; $i++){$password.=$str{rand(0,$max-1)};}
  16. return $account_admin_password;
  17. }
  18.  
  19. $account_admin_password_hash = hash('sha512', $account_admin_password);
  20. $account_admin_reset_code_hash = hash('sha512', $account_admin_reset_code);
  21.  
  22. //creates a 3 character sequence [password]
  23.  
  24. function createSalt()
  25. {
  26. $string = md5(uniqid(rand(), true));
  27. return substr($string, 0, 3);
  28. }
  29. $account_admin_password_salt = createSalt();
  30. $account_admin_password_hash = hash('sha512', $account_admin_password_salt . $account_admin_password_hash);
  31.  
  32. $account_admin_reset_code_salt = createSalt();
  33. $account_admin_reset_code_hash = hash('sha512', $account_admin_reset_code_salt . $account_admin_reset_code_hash);
  34.  
  35. <cut the rest out>
Add Comment
Please, Sign In to add comment