except remember user, changed all cookies to sessions.
This commit is contained in:
@@ -18,7 +18,7 @@ function article_page_from_markdown($article_id)
|
||||
|
||||
<div class="row">
|
||||
<h1>' . $article['title'] . '</h1>
|
||||
' . (isset($_COOKIE['user_id']) && $_COOKIE['user_id'] == $article['author_id'] ? '<a href="articles.php?view=compose&article_id=' . $article_id . '"><i class="nf nf-fa-edit"></i></a>' : '') . '
|
||||
' . (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $article['author_id'] ? '<a href="articles.php?view=compose&article_id=' . $article_id . '"><i class="nf nf-fa-edit"></i></a>' : '') . '
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col_right">
|
||||
|
||||
+10
-10
@@ -9,15 +9,15 @@ $nav = '
|
||||
<li><a href="/articles.php?view=sort&sort=newest"' . ($current_page == '/articles.php' ? ' class="underline"' : '') . '>Articles</a></li>
|
||||
';
|
||||
|
||||
if (isset($_COOKIE['role_id']) && $_COOKIE['role_id'] <= 2) {
|
||||
$nav .= '
|
||||
if (isset($_SESSION['role_id']) && $_SESSION['role_id'] <= 2) {
|
||||
$nav .= '
|
||||
<li><a href="/admin.php?view=users"' . ($current_page == '/admin.php' ? ' class="underline"' : '') . '>Admin</a></li>
|
||||
';
|
||||
}
|
||||
|
||||
if (isset($_COOKIE['user_id'])) {
|
||||
$nav .= '
|
||||
<li><a href="/user.php?view=display&user_id=' . $_COOKIE['user_id'] . '"' . ($current_page == '/user.php' ? ' class="underline"' : '') . '>Account</a></li>
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
$nav .= '
|
||||
<li><a href="/user.php?view=display&user_id=' . $_SESSION['user_id'] . '"' . ($current_page == '/user.php' ? ' class="underline"' : '') . '>Account</a></li>
|
||||
';
|
||||
}
|
||||
|
||||
@@ -30,21 +30,21 @@ $nav .= '
|
||||
|
||||
$theme_toggle = '';
|
||||
if ($_SESSION['theme'] == 'dark')
|
||||
$theme_toggle = 'light';
|
||||
$theme_toggle = 'light';
|
||||
else
|
||||
$theme_toggle = 'dark';
|
||||
$theme_toggle = 'dark';
|
||||
|
||||
$nav .= '
|
||||
<button id="theme_toggle" value="' . $theme_toggle . '" name="theme"><i class="nf ' . ($theme_toggle == 'dark' ? 'nf-oct-moon' : 'nf-oct-sun') . '"></i></button>
|
||||
</form>
|
||||
';
|
||||
|
||||
if (isset($_COOKIE['username'])) {
|
||||
$nav .= '
|
||||
if (isset($_SESSION['username'])) {
|
||||
$nav .= '
|
||||
<a href="user.php?view=logout">Log Out</a>
|
||||
';
|
||||
} else {
|
||||
$nav .= '
|
||||
$nav .= '
|
||||
<a href="user.php?view=login">Login</a>
|
||||
<a href="user.php?view=signup">Sign Up</a>
|
||||
';
|
||||
|
||||
@@ -8,7 +8,7 @@ function request_role_change_form()
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$roles .= '
|
||||
<label class="form_checkbox_container">' . $row['role'] . '
|
||||
<input name="requested_role" value="' . $row['role_id'] . '" type="radio"' . ($row['role_id'] == $_COOKIE['role_id'] ? ' checked' : '') . '>
|
||||
<input name="requested_role" value="' . $row['role_id'] . '" type="radio"' . ($row['role_id'] == $_SESSION['role_id'] ? ' checked' : '') . '>
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
';
|
||||
|
||||
@@ -19,7 +19,7 @@ function user_view($user_id)
|
||||
// TODO: Allow user to update profile picture.
|
||||
// <button id="update_profile_picture_form_button" class="modal_button underline">Update Profile Picture</button>
|
||||
// <div id="update_profile_picture_form" class="modal_form">' . update_profile_picture_form() . '</div>
|
||||
if ((isset($_COOKIE['user_id']) && $_COOKIE['user_id'] == $user_id) || (isset($_COOKIE['role_id']) && $_COOKIE['role_id'] <= 2)) {
|
||||
if ((isset($_SESSION['user_id']) && $_SESSION['user_id'] == $user_id) || (isset($_SESSION['role_id']) && $_SESSION['role_id'] <= 2)) {
|
||||
$view .= '
|
||||
<h3>User Actions</h3>
|
||||
<div class="user_actions">
|
||||
|
||||
Reference in New Issue
Block a user