diff --git a/app/core/Config.php b/app/core/Config.php index 10dcef9..72b7dc4 100644 --- a/app/core/Config.php +++ b/app/core/Config.php @@ -9,8 +9,7 @@ class Config { if (!file_exists($path)) { - echo("Could not find $path"); - throw new Exception("Could not find $path"); + throw new Exception("Could not find configuration file: $path"); } $this->config = require $path; } diff --git a/public/simulator.php b/public/simulator.php index f54348e..30ecbfb 100644 --- a/public/simulator.php +++ b/public/simulator.php @@ -1,20 +1,22 @@ model('Simulator'); if ($_SERVER['REQUEST_METHOD'] === 'POST') { - if (!isset($_POST['cardnumber']) || empty($_POST['cardnumber'])) + if (!empty($_POST['cardnumber'])) { - $app->session->flash('Kortnummer kan ikke være tom!', 'danger'); - } else { - $model = $app->model('Simulator'); + $cardnumber = $_POST['cardnumber']; - if ($model->insert($_POST['cardnumber'])) + if ($model->insert($cardnumber)) { - $app->session->flash("Lag funnet for \"{$_POST['cardnumber']}\"", "success"); + $app->session->flash("Lag funnet for \"{$cardnumber}\"", "success"); } else { - $app->session->flash("Opprettet lag for \"{$_POST['cardnumber']}\""); + $app->session->flash("Opprettet lag for \"{$cardnumber}\""); } + + } else { + $app->session->flash('Kortnummer kan ikke være tom!', 'danger'); } }