Location: PHPKode > projects > RabbitBB - Online Web Storage Project > mywebdrive/PHP_CON/user/BSUserAccount.php
<?PHP
//General BS
class BSUserAccount
{
	function BSUserAccount()
	{
	}

	function getUserAccount($inpara)
	{
		if (is_numeric($inpara))
		{
			$daoua = new DAOUserAccount();
			return $daoua->getUserbyid($inpara);
		}
		else
		{
			$daoua = new DAOUserAccount();
			return $daoua->getUserbylogin($inpara);
		}

	}
	
	function getUserBalance($inpara)
	{
		$tua = $this->getUserAccount($inpara);
		if ($tua!=null)
		{
			return $tua->getBalance();
		}
	}

	function newUserAccount($nusername, $nuserpassword,
			$nfirstname, $nlastname, $nage, $ngender,
			$noccupation, $nemail, $nmobile, $naddr1,
			$naddr2, $nbalance, $nacctype, $nlevel, $nstatus)
	{
		$ua = new UserAccount(-1, $nusername, $nuserpassword,
					$nfirstname, $nlastname, $nage, $ngender,
					$noccupation, $nemail, $nmobile, $naddr1,
					$naddr2, $nbalance, $nacctype, $nlevel, $nstatus);
		$daoua = new DAOUserAccount();
	}


	function authUser($username, $password)
	{
		$tua = $this->getUserAccount($username);
		if (count($tua)>0)
		{
			if ($password==$tua[0]->getUserpassword())
			{
				if ($tua[0]->status!=1)
					return ACCOUNTNOTACTIVE;
				else
					return $tua[0]->getUserid();
			}
			else
				return WRONGPASSWORD;
		}
		else
			return NOTEXISTINGUSER;
	}

}
Return current item: RabbitBB - Online Web Storage Project