1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 | <?
$url = urlencode(htmlentities($_GET['url'], ENT_NOQUOTES));
if(isset($url)){
$source = file_get_contents($url);
$source = htmlspecialchars($source);
$uhoh[0] = '/<?/';
$uhoh[1] = '/<%/';
$uhoh[2] = '/?>/';
$uhoh[3] = '/%>/';
$phew[0] = '<?';
$phew[1] = '<%';
$phew[2] = '?>';
$phew[3] = '%>';
$source = preg_replace($uhoh, $phew, $source);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> <?if(isset($url)){echo 'View page source of '.urldecode($url);}else{echo'View source of remote files';}?></title>
</head>
<body>
<?php
if(!isset($url)){
echo '<form action="'.$PHP_SELF.'" method="get">
<p>
<input type="text" name="url" value="http://yoururlhere/file.htm" />
</p>
</form>';
}
else{
echo $source;
}
?>
</body>
</html>
|