public static function getUser($username) { $db = new \Shop\Database(); $obtainedUser = $db->fetchUser($username); if ($obtainedUser == false) { return false; } return $obtainedUser; }
public function signup($username, $address, $password, $repassword) { $db = new \Shop\Database(); if (!$this->checkUsername($username)) { return false; } if (!$db->usernameAvailable($username)) { $this->errorMessage = "Username not available!"; return false; } $passwordOK = $this->checkPasswordSecurity($password, $repassword); if ($passwordOK) { $hash = password_hash($password, PASSWORD_DEFAULT); $_SESSION['user'] = [$username, $address]; $db->addUser($username, $this->untagAddress($address), $hash); return true; } return false; }