Advertisement
SashaRaaa

Untitled

Jul 6th, 2018
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function getUsersList() {
  4. $users = ['vasya' => '$2y$10$2N3wzuBc1MbBDgTF2OuslOAUrOWQPOkBoeh2dkxppawyfseyohtnw', 'petya' => '$2y$10 $ ApoS02iv.OuZIFcl / aD1duTHaReLxaChjcxG4aG6YL7Hxxxe8fvtw', 'misha' => '$2y$10$95JfbQirXu7Izz.UnWqKyOpuem4ACQTOZaSBMuZcatRzz43qpgnne'];
  5. return $users;
  6. }
  7.  
  8. function existsUser($login, $users){
  9.  
  10. if (array_key_exists($login, $users)) {
  11.     return true;
  12. } else {
  13.     return false;
  14. }
  15. }
  16.  
  17. function сheckPassword($login, $password, $users ){
  18.  
  19. $hash = $users['vasya'];
  20.  
  21. if (existsUser($login, $users)) {
  22.         return true;
  23. } else {
  24.     return false;
  25. } if (password_verify($password, $hash)) {
  26.     return true;
  27.     }
  28.  
  29. }
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement