DEMO: http://mikor.clearlyhosted.org/proxy.php?p=http://www.google.com
If you view the source (or hover over the links) the target path hasnt been changed properly... heres the code:
If you view the source (or hover over the links) the target path hasnt been changed properly... heres the code:
PHP:
<?php
$page = $_GET['p'];
$ext = substr(strrchr($url, "."), 1);
$contents = file_get_contents($page);
$exts['html'] = array("htm","html","shtml","php","php3","php4","php5","phtml");
$exts['application'] = array("zip","rar","ext");
$exts['image'] = array("bmp","jpg","jpeg","gif","png","jp2");
$exts['video'] = array("mov","wmv","avi","asf","rm","mpg","mp4","mpeg");
$exts['audio'] = array("mp3","wma","wmp","ogg","midi","mid","aiff");
if(in_array($ext,$exts['html'])){
header("Content-type: text/html");
FixHTML($contents);
}elseif(in_array($ext,$exts['application'])){
header("Content-type: application/".$ext);
EchoItIt($contents);
}elseif(in_array($ext,$exts['image'])){
header("Content-type: image/".$ext);
EchoIt($contents);
}elseif(in_array($ext,$exts['video'])){
header("Content-type: video/".$ext);
EchoIt($contents);
}elseif(in_array($ext,$exts['audio'])){
header("Content-type: audio/".$ext);
EchoIt($contents);
}else{
if(eregi('<html>',$contents)){
header("Content-type: text/html");
FixHTML($contents);
}else{
header("Content-type: text/plain");
EchoIt($contents);
}
}
function FixHTML($text){
//Vars
$parts = parse_url($_GET['p']);
$uri = $parts['scheme'] . '://' .$parts['host'] . $parts['path'];
//Absoloute URIs (href)
$text2 = str_replace('href = "http://','href = "http://mikor.clearlyhosted.org/proxy.php?p=',$text);
$text2 = str_replace('href= "http://','href = "http://mikor.clearlyhosted.org/proxy.php?p=',$text2);
$text2 = str_replace('href ="http://','href = "http://mikor.clearlyhosted.org/proxy.php?p=',$text2);
$text2 = str_replace('href="http://','href = "http://mikor.clearlyhosted.org/proxy.php?p=',$text2);
//Relative URIs (href)
$text2 = str_replace('href = "/','href = "http://mikor.clearlyhosted.org/proxy.php?p='.$uri.'/',$text2);
$text2 = str_replace('href= "/','href = "http://mikor.clearlyhosted.org/proxy.php?p='.$uri.'/',$text2);
$text2 = str_replace('href ="/','href = "http://mikor.clearlyhosted.org/proxy.php?p='.$uri.'/',$text2);
$text2 = str_replace('href="/','href = "http://mikor.clearlyhosted.org/proxy.php?p='.$uri.'/',$text2);
//Absoloute URIs (src)
$text2 = str_replace('src = "http://','src = "http://mikor.clearlyhosted.org/proxy.php?p=',$text);
$text2 = str_replace('src= "http://','src = "http://mikor.clearlyhosted.org/proxy.php?p=',$text2);
$text2 = str_replace('src ="http://','src = "http://mikor.clearlyhosted.org/proxy.php?p=',$text2);
$text2 = str_replace('src="http://','src = "http://mikor.clearlyhosted.org/proxy.php?p=',$text2);
//Relative URIs (src)
$text2 = str_replace('src = "/','src = "http://mikor.clearlyhosted.org/proxy.php?p='.$uri.'/',$text2);
$text2 = str_replace('src= "/','src = "http://mikor.clearlyhosted.org/proxy.php?p='.$uri.'/',$text2);
$text2 = str_replace('src ="/','src = "http://mikor.clearlyhosted.org/proxy.php?p='.$uri.'/',$text2);
$text2 = str_replace('src="/','src = "http://mikor.clearlyhosted.org/proxy.php?p='.$uri,$text2);
echo $text2;
}
function EchoIt($text){
echo $text;
}
?>





