25 lines
650 B
PHP
25 lines
650 B
PHP
<?php
|
|
$app = require '../app/inc.php';
|
|
$model = $app->model('Simulator');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST')
|
|
{
|
|
if (!empty($_POST['cardnumber']))
|
|
{
|
|
$cardnumber = $_POST['cardnumber'];
|
|
|
|
if ($model->insert($cardnumber))
|
|
{
|
|
$app->session->flash("Lag funnet for \"{$cardnumber}\"", "success");
|
|
} else {
|
|
$app->session->flash("Opprettet lag for \"{$cardnumber}\"");
|
|
}
|
|
|
|
} else {
|
|
$app->session->flash('Kortnummer kan ikke være tom!', 'danger');
|
|
}
|
|
}
|
|
|
|
$app->view('template/header', ['title' => 'Simulator']);
|
|
$app->view('simulator');
|
|
$app->view('template/footer'); |