setSafeMode(true);
$this->notesModel = new \ppa\Model\NotesModel();
$isEditMode = true;
$note = null;
if ($isEditMode) {
$noteId = $_GET['id'] ?? 0;
$note = $this->notesModel->getNoteById($noteId, $_SESSION['user_id']);
if (!$note) {
echo "
Note not found or you don't have permission to edit it.
";
echo "Back to Dashboard";
}
}
function isLoggedIn() {
return isset($_SESSION['user_id']);
}
function isAdmin() {
return isLoggedIn() && isset($_SESSION['role']) && $_SESSION['role'] === 'admin';
}
function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
return htmlspecialchars((string)$data, $flags, $encoding);
}
?>
Drag & drop a .txt or .md file here, or fill manually.