Guest User

Untitled

a guest
May 20th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. function ddAuthValidateCredentials($username = null, $password = null) {
  4. $user = $this->user_model->find($username);
  5. // Maybe your password is stored in plaintext (BAD) in the database.
  6. if ( $password == $user['password'] ) {
  7. return $user['user_id'];
  8. }
  9. return null;
  10. }
  11.  
  12. function ddAuthValidateCredentials($username = null, $password = null) {
  13. $user = $this->user_model->find($username);
  14. // Maybe your password is encrypted in the database against a salt
  15. // for the user. In that case, crypt the password we received
  16. // with the user's salt and see if it matches.
  17. if ( crypt($password, $user['salt']) == $user['encrypted_password'] ) {
  18. return $user['user_id'];
  19. }
  20. return null;
  21. }
  22.  
  23. ?>
Add Comment
Please, Sign In to add comment