Forum Moderators: coopster
$page = $_GET['page'];if ($page!= "") {
$fetch = fopen($page,"r");
if (!$fetch) {
$page = "http://$page";
$fetch = fopen($page,"r");
}
if (!$fetch) {
echo $url_error;
break;
}
$source = fread($fetch, 262144);
fclose($fetch);
$source = htmlspecialchars($source);
echo $source;
}
else {
echo $no_url_error;
}
Nice, huh? So i can get the source code for, for example, Google's home page with:
source.php?page=www.google.com
etc.
Spotted the problem yet? How about:
source.php?page=/etc/passwd
Yup, works great too :-( Eek!
So basically, my question is: how do I stop this? Just for this particular file you understand, not for other PHP files on my server (as many Apache tweaks have it) so that it will work great for everything except my server?
(Apache 1.3.33/PHP 4.3.11/Slackware)
TIA, J.