2017-10-07 23:12:10 +02:00
|
|
|
<?php
|
|
|
|
require __DIR__ . '/../../../src/_autoload.php';
|
|
|
|
require __DIR__ . '/../../../sql_config.php';
|
|
|
|
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
|
|
|
|
$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');
|
|
|
|
$as = new SimpleSAML_Auth_Simple('default-sp');
|
|
|
|
$as->requireAuth();
|
|
|
|
$attrs = $as->getAttributes();
|
|
|
|
$uname = $attrs['uid'][0];
|
|
|
|
|
|
|
|
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
|
|
|
echo 'Ingen tilgang';
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-10-07 23:12:10 +02:00
|
|
|
$eventID = $_GET['id'];
|
|
|
|
|
|
|
|
$query = 'DELETE FROM events WHERE id=\'' . $eventID . '\'';
|
|
|
|
$statement = $pdo->prepare($query);
|
|
|
|
$statement->execute();
|
|
|
|
|
2017-10-12 00:38:28 +02:00
|
|
|
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
2017-10-08 03:33:42 +02:00
|
|
|
?>
|
|
|
|
|
2017-10-22 17:57:55 +02:00
|
|
|
<a href=".?page=1">Om du ikke ble omdirigert tilbake klikk her</a>
|