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/teamtable/edit/delete.php

32 lines
738 B
PHP
Raw Normal View History

2022-02-09 15:59:20 +00:00
<?php
$app = require '../../../app/inc.php';
$model = $app->model('Teamtable');
if (!isset($_GET['item']))
{
$app->session->flash('LagID ikke definert som GET parameter', 'danger');
$app->redirect('index.php');
}
$id = $_GET['item'];
// ID must be numeric
if (!is_numeric($id))
{
$app->session->flash('LagID må være tall', 'danger');
$app->redirect('index.php');
}
// Check if ID is in teamtable
$currentTeam = $model->getTeamByID($id);
if (!$currentTeam)
{
$app->session->flash("Kunne ikke slette lag: LagID \"$id\" finnes ikke", "danger");
$app->redirect('index.php');
}
$model->deleteTeamByID($id);
$app->session->flash("Slettet lag: {$currentTeam['LagNavn']}", "success");
$app->redirect('index.php');