30 lines
887 B
PHP
30 lines
887 B
PHP
<?php $app = require '../app/inc.php';
|
|
|
|
// TODO: refactor
|
|
|
|
$cardreader = $app->model('Cardreader');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST')
|
|
{
|
|
if (isset($_POST['cardnumber']) && strlen($_POST['cardnumber']) !== 0)
|
|
{
|
|
$cardnumber = $_POST['cardnumber'];
|
|
|
|
if (!(strlen($cardnumber) > 32)) {
|
|
if ($cardreader->receive($cardnumber))
|
|
{
|
|
$app->session->flash("Lag funnet for \"{$cardnumber}\"", "success");
|
|
} else {
|
|
$app->session->flash("Opprettet lag for \"{$cardnumber}\"");
|
|
}
|
|
} else {
|
|
$app->session->flash('Kortnummer for langt!', 'danger');
|
|
}
|
|
} else {
|
|
$app->session->flash('Kortnummer kan ikke være tom!', 'danger');
|
|
}
|
|
}
|
|
|
|
$app->view('template/header', ['title' => 'Simulator']);
|
|
$app->view('pages/simulator');
|
|
$app->view('template/footer'); |