The key rule is that you always check your inputs / outputs and see that you can and cannot control (and therefore what can be controlled by the user). Based on this, you apply safety / disinfection measures.
, , . , , , $_SERVER['request_uri'] ( ).
, , , , . , . @Wayne , , , .
, $_GET, $_SERVER['request_uri'].
. , , , request_uri html_entities() - . , , ../, // ./, , html_entities()
: - - ?
- , , .
------ EDIT @12-12-2013 -----
( , , , )
PHP:
$_SERVER['REQUEST_URI']: The URI which was given in order to access this page;
for instance, '/index.html'.
, , yourdomain.com/posts/post.php?../../../ssh, webapp , , post.php?../../../ssh , URL-. - ../../../ssh post.php, ssh, -. SSH-. , - - .
, - URL.
, http-, chrooting .. , , , , .
$_SERVER['request_uri'] , , , . , () PHP, , .
, , .
- : , header('location'... , : PHP ? , . , : urlencode()