Skip to content
Permalink
Browse files Browse the repository at this point in the history
XSS vulnerability (#741)
* escaped PHP_SELF
  • Loading branch information
timersys authored and serbanghita committed May 30, 2018
1 parent 4da80e5 commit 31818a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/session_example.php
Expand Up @@ -121,7 +121,7 @@ function initLayoutType()

<!-- example page #1 -->
<h1>Demo page number one.</h1>
<p>You can go to page <a href="<?php echo $_SERVER['PHP_SELF']; ?>?page=two">two</a>.</p>
<p>You can go to page <a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>?page=two">two</a>.</p>
<p>Showing you the <b><?php echo $layoutType; ?></b> version.</p>
<p><b>Note:</b> When running this test using the same browser with multiple User-Agents, clear your cookies/session before each test.</p>

Expand All @@ -131,7 +131,7 @@ function initLayoutType()

<!-- example page #2 -->
<h1>Demo page number two.</h1>
<p>You can go back to page <a href="<?php echo $_SERVER['PHP_SELF']; ?>">one</a>.</p>
<p>You can go back to page <a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">one</a>.</p>
<p>Showing you the <b><?php echo $layoutType; ?></b> version.</p>

<?php endif; ?>
Expand All @@ -141,6 +141,6 @@ function initLayoutType()
<?php if($_layoutType == $layoutType): ?>
<?php echo strtoupper($_layoutType); ?>
<?php else: ?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?layoutType=<?php echo $_layoutType; ?>"><?php echo strtoupper($_layoutType); ?></a>
<a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>?layoutType=<?php echo $_layoutType; ?>"><?php echo strtoupper($_layoutType); ?></a>
<?php endif; ?>
<?php endforeach;

0 comments on commit 31818a4

Please sign in to comment.