fabi0

Untitled

Sep 30th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. function _validUser($userName, $userPassword) {
  2.     $file = file('users.txt');
  3.     foreach ($file as $value) {
  4.         $line = explode("@", $value);
  5.         if ($line[1] == trim($userName) && trim($line[2]) == trim($userPassword)) {
  6.             $_SESSION['_logged'] = true;
  7.             $_SESSION['_userID'] = (int) $line[0];
  8.             $_SESSION['_userName'] = $line[1];
  9.             $_SESSION['_success'] .= 'Успешен вход !';
  10.             break;
  11.         }
  12.     }
  13.     if (!$_SESSION['_logged'] == true) {
  14.         $_SESSION['_error'] = 'Грешна парола или потребител !';
  15.         return (bool) 0;
  16.     } else {
  17.         return (bool) 1;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment