/apps/request/domain/RequestApp.php
http://zoop.googlecode.com/ · PHP · 27 lines · 22 code · 5 blank · 0 comment · 3 complexity · 8ed1c79384855e26c387f0d40d369823 MD5 · raw file
- <?php
- class RequestApp
- {
- static public function auth($username, $password)
- {
- $id = SqlFetchCell("select id from person where username = :username and password = :password",
- array('username' => $username, 'password' => $password));
-
- if(!$id)
- return false;
-
- $_SESSION['personId'] = $id;
- session::saveChangesUnsafe();
-
- return true;
- }
-
- static public function getLoggedInUser()
- {
- return isset($_SESSION['personId']) && $_SESSION['personId'] ? new Person($_SESSION['personId']) : false;
- }
- static public function userIsLoggedIn()
- {
- return isset($_SESSION['personId']) && $_SESSION['personId'] ? true : false;
- }
- }