Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some xss vulnerabilities #7

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions article.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$loc = "US";

if( isset( $_GET['loc'] ) ) {
$loc = strtoupper($_GET["loc"]);
$loc = urlencode(strtoupper($_GET["loc"]));
}

if( isset( $_GET['a'] ) ) {
Expand Down Expand Up @@ -69,7 +69,7 @@ function clean_str($str) {
<body>
<small><a href="/index.php?loc=<?php echo $loc ?>">< Back to <font color="#9400d3">68k.news</font> <?php echo $loc ?> front page</a></small>
<h1><?php echo clean_str($readability->getTitle());?></h1>
<p><small><a href="<?php echo $article_url ?>" target="_blank">Original source</a> (on modern site) <?php
<p><small><a href="<?php echo urlencode($article_url) ?>" target="_blank">Original source</a> (on modern site) <?php
$img_num = 0;
$imgline_html = "| Article images:";
foreach ($readability->getImages() as $image_url):
Expand All @@ -87,4 +87,4 @@ function clean_str($str) {
<p><font size="4"><?php echo $readable_article;?></font></p>
<small><a href="/index.php?loc=<?php echo $loc ?>">< Back to <font color="#9400d3">68k.news</font> <?php echo $loc ?> front page</a></small>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions choose_edition.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$loc = "US";

if( isset( $_GET['loc'] ) ) {
$loc = $_GET["loc"];
$loc = urlencode($_GET["loc"]);
}

?>
Expand Down Expand Up @@ -52,4 +52,4 @@
<small><a href="/index.php?loc=<?php echo $loc ?>">< Back to <font color="#9400d3">68k.news</font> <?php echo $loc ?>front page</a></small>
<p><center><small>Powered by Mozilla Readability (Andres Rey PHP Port) and SimplePie</small></p>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions image.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$loc = "US";

if( isset( $_GET['loc'] ) ) {
$loc = strtoupper($_GET["loc"]);
$loc = urlencode(strtoupper($_GET["loc"]));
}

//get the image url
Expand Down Expand Up @@ -43,4 +43,4 @@
<br><br>
<small><a href="<?php echo $_SERVER['HTTP_REFERER'] . '?loc=' . strtoupper($loc) ?>">< Back to article</a> | <a href="/index.php"><font color="#9400d3">68k.news</font> front page</a></small>
</body>
</html>
</html>
8 changes: 4 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
$feed_url="";

if(isset( $_GET['section'])) {
$section = $_GET["section"];
$section = urlencode($_GET["section"]);
}
if(isset( $_GET['loc'])) {
$loc = strtoupper($_GET["loc"]);
$loc = urlencode(strtoupper($_GET["loc"]));
}
if(isset( $_GET['lang'])) {
$lang = $_GET["lang"];
$lang = urlencode($_GET["lang"]);
}

if($section) {
Expand Down Expand Up @@ -96,4 +96,4 @@ function clean_str($str) {
<?php endforeach; ?>
<p><center><small>v1.0 Powered by Mozilla Readability (Andres Rey PHP Port) and SimplePie</small><center></p>
</body>
</html>
</html>