Commit
This commit is contained in:
parent
f4ef0b648e
commit
692e07f070
@ -9,8 +9,7 @@ class Config
|
|||||||
{
|
{
|
||||||
if (!file_exists($path))
|
if (!file_exists($path))
|
||||||
{
|
{
|
||||||
echo("Could not find $path");
|
throw new Exception("Could not find configuration file: $path");
|
||||||
throw new Exception("Could not find $path");
|
|
||||||
}
|
}
|
||||||
$this->config = require $path;
|
$this->config = require $path;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
$app = require '../app/inc.php';
|
$app = require '../app/inc.php';
|
||||||
|
$model = $app->model('Simulator');
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST')
|
if ($_SERVER['REQUEST_METHOD'] === 'POST')
|
||||||
{
|
{
|
||||||
if (!isset($_POST['cardnumber']) || empty($_POST['cardnumber']))
|
if (!empty($_POST['cardnumber']))
|
||||||
{
|
{
|
||||||
$app->session->flash('Kortnummer kan ikke være tom!', 'danger');
|
$cardnumber = $_POST['cardnumber'];
|
||||||
} else {
|
|
||||||
$model = $app->model('Simulator');
|
|
||||||
|
|
||||||
if ($model->insert($_POST['cardnumber']))
|
if ($model->insert($cardnumber))
|
||||||
{
|
{
|
||||||
$app->session->flash("Lag funnet for \"{$_POST['cardnumber']}\"", "success");
|
$app->session->flash("Lag funnet for \"{$cardnumber}\"", "success");
|
||||||
} else {
|
} else {
|
||||||
$app->session->flash("Opprettet lag for \"{$_POST['cardnumber']}\"");
|
$app->session->flash("Opprettet lag for \"{$cardnumber}\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$app->session->flash('Kortnummer kan ikke være tom!', 'danger');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user