PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/apps/request/domain/RequestApp.php

http://zoop.googlecode.com/
PHP | 27 lines | 22 code | 5 blank | 0 comment | 3 complexity | 8ed1c79384855e26c387f0d40d369823 MD5 | raw file
 1<?php
 2class RequestApp
 3{
 4	static public function auth($username, $password)
 5	{
 6		$id = SqlFetchCell("select id from person where username = :username and password = :password",
 7				array('username' => $username, 'password' => $password));
 8		
 9		if(!$id)
10			return false;
11		
12		$_SESSION['personId'] = $id;
13		session::saveChangesUnsafe();
14		
15		return true;
16	}
17	
18	static public function getLoggedInUser()
19	{
20		return isset($_SESSION['personId']) && $_SESSION['personId'] ? new Person($_SESSION['personId']) : false;
21	}
22
23	static public function userIsLoggedIn()
24	{
25		return isset($_SESSION['personId']) && $_SESSION['personId'] ? true : false;
26	}
27}