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

<?php
$app = require '../app/inc.php';
$model = $app->model('Simulator');
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
if (!empty($_POST['cardnumber']))
{
$cardnumber = $_POST['cardnumber'];
if (!(strlen($cardnumber) > 32)) {
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 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');