This repository has been archived on 2023-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
web/public/simulator.php

28 lines
818 B
PHP
Raw Normal View History

2022-01-24 10:54:42 +00:00
<?php
$app = require '../app/inc.php';
2022-01-27 21:08:06 +00:00
$model = $app->model('Simulator');
2022-01-24 10:54:42 +00:00
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
2022-01-27 21:08:06 +00:00
if (!empty($_POST['cardnumber']))
2022-01-24 10:54:42 +00:00
{
2022-01-27 21:08:06 +00:00
$cardnumber = $_POST['cardnumber'];
2022-01-26 13:38:22 +00:00
2022-02-14 10:23:05 +00:00
if (!(strlen($cardnumber) > 32)) {
if ($model->insert($cardnumber))
{
$app->session->flash("Lag funnet for \"{$cardnumber}\"", "success");
} else {
$app->session->flash("Opprettet lag for \"{$cardnumber}\"");
}
2022-01-26 13:38:22 +00:00
} else {
2022-02-14 10:23:05 +00:00
$app->session->flash('Kortnummer for langt!', 'danger');
2022-01-26 13:38:22 +00:00
}
2022-01-27 21:08:06 +00:00
} else {
$app->session->flash('Kortnummer kan ikke være tom!', 'danger');
2022-01-24 10:54:42 +00:00
}
}
$app->view('template/header', ['title' => 'Simulator']);
2022-02-08 21:59:47 +00:00
$app->view('pages/simulator');
2022-01-24 10:54:42 +00:00
$app->view('template/footer');