<?php

require_once 'DatabaseConnector.php';

class User extends DatabaseConnector
{

   /**
    * Sprawdza uprawnienia użytkownika
    * @access remote
    * @returns status of user login attempt
    */
   function login($user, $pass)
   {
      $link = $this->getConnection();

      $loggedIn = false;

      $query = sprintf("SELECT * FROM users WHERE username='%s' AND password=MD5('%s')", $user, ($pass));
      $result = mysql_query($query, $link);

      if (mysql_num_rows($result) > 0)
      {
         $loggedIn = true;
      }

      return array('response' => $loggedIn);
   }

   //TODO: Add session storage

}

?>
