Commit
This commit is contained in:
parent
768c040e86
commit
cb28dbaaba
@ -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,11 +35,10 @@ 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 {
|
||||
} else {
|
||||
$app->session->flash('Kortnummer kan ikke være tom!', 'danger');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user