2017-10-28 16:44:56 +02:00
|
|
|
<?php
|
|
|
|
require __DIR__ . '/../../../src/_autoload.php';
|
2024-02-15 22:57:03 +01:00
|
|
|
require __DIR__ . '/../../../config.php';
|
2024-03-12 19:33:09 +01:00
|
|
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
2017-10-28 16:44:56 +02:00
|
|
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
2017-11-11 17:06:56 +01:00
|
|
|
$userManager = new \pvv\admin\UserManager($pdo);
|
|
|
|
|
|
|
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
2024-04-08 22:11:43 +02:00
|
|
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
2017-11-11 17:06:56 +01:00
|
|
|
$as->requireAuth();
|
|
|
|
$attrs = $as->getAttributes();
|
|
|
|
$uname = $attrs['uid'][0];
|
|
|
|
|
|
|
|
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
2017-11-11 20:37:04 +01:00
|
|
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
2017-11-11 17:06:56 +01:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-10-28 16:44:56 +02:00
|
|
|
$projectID = $_GET['id'];
|
|
|
|
|
|
|
|
$query = 'DELETE FROM projects WHERE id=\'' . $projectID . '\'';
|
|
|
|
$statement = $pdo->prepare($query);
|
|
|
|
$statement->execute();
|
|
|
|
|
|
|
|
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
|
|
|
?>
|
|
|
|
|
|
|
|
<a href=".?page=1">Om du ikke ble omdirigert tilbake klikk her</a>
|