This commit is contained in:
William 2022-03-19 22:48:04 +01:00
parent 768c040e86
commit cb28dbaaba

View File

@ -1,7 +1,5 @@
<?php $app = require '../../app/inc.php';
// TODO: refactor
$cardreader = $app->model('Cardreader');
if ($_SERVER['REQUEST_METHOD'] === 'POST')
@ -10,8 +8,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
$cardnumber = $_POST['cardnumber'];
if (!(strlen($cardnumber) > 32)) {
try {
$code = $cardreader->receive($cardnumber, 5);
switch ($code) {
case 0:
@ -38,9 +35,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST')
$app->session->flash('Uhhh?? Dette skulle ikke skje', 'danger');
break;
}
} else {
$app->session->flash('Kortnummer for langt!', 'danger');
} catch (InvalidArgumentException $e) {
$app->session->flash("Noe gikk galt: {$e->getMessage()}", "danger");
}
} else {
$app->session->flash('Kortnummer kan ikke være tom!', 'danger');