except remember user, changed all cookies to sessions.

This commit is contained in:
2025-04-13 20:07:07 -06:00
parent 006cffef38
commit 3ef61e1c9e
24 changed files with 42 additions and 158 deletions
+3 -3
View File
@@ -21,7 +21,7 @@ if (isset($_POST['form_id'])) {
update_article($_POST['article_id'], $_POST['title'], $_POST['excerpt'], $tags, $_POST['markdown']);
header('Location: articles.php?article_id=' . $_POST['article_id']);
} else {
$id = create_article($_COOKIE['user_id'], $_POST['title'], $_POST['excerpt'], (isset($_POST['tags']) ? $_POST['tags'] : []), $_POST['markdown']);
$id = create_article($_SESSION['user_id'], $_POST['title'], $_POST['excerpt'], (isset($_POST['tags']) ? $_POST['tags'] : []), $_POST['markdown']);
header('Location: articles.php?article_id=' . $id);
}
@@ -50,7 +50,7 @@ if (isset($_POST['form_id'])) {
echo article_list(article_ids_by_newest());
break;
case 'read':
if (isset($_COOKIE['user_id']) && isset($_GET['article_id'])) {
if (isset($_SESSION['user_id']) && isset($_GET['article_id'])) {
increment_read_counter($_GET['article_id']);
echo article_page_from_markdown($_GET['article_id']);
} else {
@@ -67,7 +67,7 @@ if (isset($_POST['form_id'])) {
}
}
if (($view == 'list' || $view == 'sort') && (isset($_COOKIE['role_id']) && $_COOKIE['role_id'] <= 3)) {
if (($view == 'list' || $view == 'sort') && (isset($_SESSION['role_id']) && $_SESSION['role_id'] <= 3)) {
echo '
<div id="floating_compose">
<a href="articles.php?view=compose"><i class="nf nf-md-note_plus"></i></a>