Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <?php
  2. function encrypt($password,$encryption){
  3.  
  4. switch ($encryption){
  5. case "crypt":
  6. case "crypt":
  7. case "1":
  8. /* Obviousely the right way of crypting passwords with salts does not work when checking passwords
  9. against a stored one in the database. This affects changeadminpassword.php.
  10.  
  11. As a workaround, the salt will be the cleartext password.
  12.  
  13. In future it would be better to have a random salt and another solution for changadminpassword.php.
  14. This would probably means to abstract adminusers and accountusers in crypto.php
  15. */
  16.  
  17. #$password=crypt($password,substr(md5(rand()),0,2));
  18. $password=crypt($password,$password);
  19. break;
  20. }
  21.  
  22. // Encrypt should always return something - on plaintext unchanged input
  23. return $password;
  24. }
  25.  
  26.  
  27. $new_password = encrypt(lol, crypt);
  28. //$query = "UPDATE accountuser SET password='$new_password' WHERE username='".$_POST['username']."'";
  29.  
  30. echo $new_password
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement