Time to do an update.

This commit is contained in:
Cody Cook 2025-01-09 11:57:11 -08:00
commit 0b0697bb42
22 changed files with 4352 additions and 268 deletions

View file

@ -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)
{
}
}