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]);
if ($sth->rowCount())
{
return TRUE;
$row = $sth->fetch(PDO::FETCH_ASSOC);
if (
$row['Brukernavn'] === $username &&
$row['Passord'] === $password
)
{
return TRUE;
}
}
return FALSE;
}

View File

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

View File

@ -5,11 +5,11 @@ if ($app->user->logged_in)
$app->redirect('index.php');
}
$username = (string)filter_input(INPUT_POST, 'username');
$password = (string)filter_input(INPUT_POST, 'password');
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))
{
$app->session->flash("Velkommen {$username}!");