SimpleAccount.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /** @package verysimple::Authentication */
  3. require_once("IAuthenticatable.php");
  4. /**
  5. * simple implementation of IAuthenticatable for using a basic
  6. * hard-coded username/password combination.
  7. * @package verysimple::Authentication
  8. * @author VerySimple Inc.
  9. * @copyright 1997-2007 VerySimple, Inc.
  10. * @license http://www.gnu.org/licenses/lgpl.html LGPL
  11. * @version 1.0
  12. */
  13. class SimpleAccount implements IAuthenticatable
  14. {
  15. private $_authenticated = false;
  16. private $_username;
  17. private $_password;
  18. public function __construct($required_username,$required_password)
  19. {
  20. $this->_username = $required_username;
  21. $this->_password = $required_password;
  22. }
  23. public function IsAnonymous()
  24. {
  25. return (!$this->_authenticated);
  26. }
  27. public function IsAuthorized($permission)
  28. {
  29. return $this->_authenticated;
  30. }
  31. public function Login($username,$password)
  32. {
  33. if ($this->_username == $username && $this->_password == $password)
  34. {
  35. $this->_authenticated = true;
  36. return true;
  37. }
  38. return false;
  39. }
  40. /**
  41. * This is implemented only for Phreeze but is not utilized
  42. * @param object
  43. */
  44. public function Refresh($obj)
  45. {
  46. }
  47. }
  48. ?>