This commit is contained in:
William 2022-05-30 17:43:00 +00:00
parent bd6bc07a52
commit 22f023b040
3 changed files with 13 additions and 6 deletions

View File

@ -96,7 +96,14 @@ class User
$sth->execute([$username, $password]); $sth->execute([$username, $password]);
if ($sth->rowCount()) if ($sth->rowCount())
{ {
return TRUE; $row = $sth->fetch(PDO::FETCH_ASSOC);
if (
$row['Brukernavn'] === $username &&
$row['Passord'] === $password
)
{
return TRUE;
}
} }
return FALSE; return FALSE;
} }

View File

@ -97,8 +97,8 @@ class TeamMapper
$team->rounds, $team->rounds,
$team->best_time $team->best_time
]); ]);
$lastId = $this->dbh->lastInsertId(); $last_id = $this->dbh->lastInsertId();
return $this->get($lastId); return $this->get($last_id);
} }
public function update(Team $team): Team public function update(Team $team): Team

View File

@ -5,11 +5,11 @@ if ($app->user->logged_in)
$app->redirect('index.php'); $app->redirect('index.php');
} }
$username = (string)filter_input(INPUT_POST, 'username');
$password = (string)filter_input(INPUT_POST, 'password');
if ($_SERVER['REQUEST_METHOD'] === 'POST') if ($_SERVER['REQUEST_METHOD'] === 'POST')
{ {
$username = (string)filter_input(INPUT_POST, 'username');
$password = (string)filter_input(INPUT_POST, 'password');
if ($app->user->login($username, $password)) if ($app->user->login($username, $password))
{ {
$app->session->flash("Velkommen {$username}!"); $app->session->flash("Velkommen {$username}!");