Time to do an update.
This commit is contained in:
parent
70c8a87e15
commit
0b0697bb42
22 changed files with 4352 additions and 268 deletions
|
@ -27,6 +27,9 @@ Class User{
|
|||
* @throws RandomException
|
||||
*/
|
||||
public function newUser($username, $password, $email){
|
||||
if ($this->check_existing_user($username, $email)){
|
||||
throw new RandomException("User already exists");
|
||||
}
|
||||
$this->username = $username;
|
||||
$this->email = $email;
|
||||
$password2 = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
@ -48,5 +51,19 @@ Class User{
|
|||
|
||||
}
|
||||
|
||||
private function check_existing_user($username, $email){
|
||||
$stmt = $this->db->prepare("SELECT * FROM users WHERE username = ? OR email = ?");
|
||||
$stmt->bind_param("ss", $username, $email);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$user = $result->fetch_assoc();
|
||||
$stmt->close();
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function login(mixed $username, mixed $password)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue