Is there a way to make it safe, to use <?php include "$_GET[page]"; ?>
?
I have been using:
<?php
$string = $_SERVER['QUERY_STRING'];
if(stristr($string, 'http') === FALSE && stristr($string, '/') === FALSE) {}
else
die();
$string = "$_SERVER[QUERY_STRING]";
if (
stristr($string, '<') === FALSE &&
stristr($string, '>') === FALSE &&
stristr($string, '%3C') === FALSE &&
stristr($string, '%3E') === FALSE &&
stristr($string, '"') === FALSE &&
stristr($string, '%22') === FALSE) {}
else
die();
$string = $_GET['page'];
if ($string[0] == '/')
die();
$string = $_GET['back'];
if ($string[0] == '/')
die();
$protect = 1;
?>
but i am not entirely sure if that is safe... is there a better way to include files that are in a URL string... security-wise?