Location: PHPKode > projects > PhpwdManager > phpwdmanager/contents/auth.php
<?php

//user class

class auth extends TUser
{
	private $user_id = null;
	private $lang = null;
	
	function setUserId($user_id)
	{
		$this->user_id = $user_id;
	}
	
	function getUserId()
	{
		return $this->user_id;
	}
	
	function setUserLang($lang)
	{
		return $this->lang = $lang;
	}
	
	function getUserLang()
	{
		return $this->lang;
	}
	
	function login($lang, $username, $password, $db_data)
	{
		$succeed = true;
		
		if (count($db_data) > 0)
		{
			if (md5(strtoupper($password)) === $db_data['user_password'])
			{	
				$this->setUserLang($lang);
				$this->setUserId($db_data['user_id']);
				$this->setUsername($username);
			}
			else
				$succeed = false;
		}
		else
			$succeed = false;
		
		$this->setAuthenticated($succeed);	
			
		return $succeed;
	}
	
	function logout($transfer = true)
	{
		parent::logout();
		
		if ($transfer === true)
			pradoGetApplication()->transfer("login", array("lang" => $this->lang));
	}
}

?>
Return current item: PhpwdManager