added login requirement to view articles to protect against potential data scrapping, with redirect functionality to the article the user attempts to view prior to login.
This commit is contained in:
+7
-2
@@ -36,7 +36,6 @@ if (!isset($_GET['article_id']) && !isset($_GET['tag']) && !isset($_GET['author_
|
||||
</form>
|
||||
';
|
||||
|
||||
|
||||
echo '
|
||||
<div class="article_cards_grid">
|
||||
<div class="article_filters">
|
||||
@@ -50,7 +49,7 @@ if (!isset($_GET['article_id']) && !isset($_GET['tag']) && !isset($_GET['author_
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
} else if (isset($_GET['article_id'])) {
|
||||
} else if (isset($_COOKIE['user_id']) && isset($_GET['article_id'])) {
|
||||
increment_read_counter($_GET['article_id']);
|
||||
echo article_page_from_markdown($_GET['article_id']);
|
||||
} else if (isset($_GET['author_id'])) {
|
||||
@@ -63,6 +62,12 @@ if (!isset($_GET['article_id']) && !isset($_GET['tag']) && !isset($_GET['author_
|
||||
|
||||
foreach ($ids as $id)
|
||||
echo article_card($id);
|
||||
} else {
|
||||
$redirect = (isset($_GET['article_id']) ? 'articles.php?article_id=' . $_GET['article_id'] : '');
|
||||
if ($redirect)
|
||||
header('Location: user.php?action=login&redirect=' . urlencode($redirect));
|
||||
else
|
||||
header('Location: articles.php');
|
||||
}
|
||||
|
||||
include_once 'components/foot.php';
|
||||
|
||||
Reference in New Issue
Block a user