Part on authorisation finished

This commit is contained in:
Patryk Hegenberg 2022-12-18 15:08:59 +01:00
parent 0c5e0088f7
commit 44a6d295d8
2 changed files with 26 additions and 15 deletions

View file

@ -1,11 +1,21 @@
<?php
$username = 'appUser';
$password = 'password';
$config = require('config.php');
$db = new Database($config['database'], $username, $password);
$username = 'appUser';
$password = 'password';
$config = require('config.php');
$db = new Database($config['database'], $username, $password);
$heading = "Note";
$heading = "Note";
$note = $db->query('select * from notes where id = :id', ['id' => $_GET['id']] )->fetch();
//dd($notes);
require "views/note.view.php";
$note = $db->query('select * from notes where id = :id', [
'id' => $_GET['id']
])->fetch();
if (!$note) {
abort();
}
$currentUserId = 1;
if ($note['user_id'] != $currentUserId) {
abort(Response::FORBIDDEN);
}
//dd($notes);
require "views/note.view.php";