';
// Horizontal
$h_tag='
';
// Load Links
include ("includes/links.php");
// Load libraries
include ("includes/functions_utils.php");
include ("includes/functions_cache.php");
// Locate web
$web=str_replace("www.","",$_SERVER['HTTP_HOST']);
$web=str_replace(".turincon.com","",$web);
// URI
if (substr($_SERVER['REQUEST_URI'],strlen($_SERVER['REQUEST_URI'])-1)=="/") $uri=substr($_SERVER['REQUEST_URI'],strlen($_SERVER['REQUEST_URI'])); else $uri=$_SERVER['REQUEST_URI'];
// Load webpage
if (check_cache($web,$uri)) {
echo get_cache_data($web,$uri);
#shell_exec ("echo ".$web." - ".$data[1].$uri." loaded from cache on ".date("m-d-y H:i:s")." >> /var/log/turincon");
}
else {
// Load libraries for process html
include ("includes/functions_processhtml.php");
// Get data from the web
$data=get_info($web);
// Detect redirections to it's own
if ($data[1]==$_SERVER['HTTP_HOST'] or str_replace("www.","",$data[1])==$_SERVER['HTTP_HOST'] or "www.".$data[1]==$_SERVER['HTTP_HOST'])
{
# echo "
$h_tag";
echo "Error grave
";
echo "No se puede redireccionar una web sobre si misma
";
# echo "$h_tag";
die();
}
// Print the webpage REAL url
//echo "";
// Get the content of the URL
$html= html_fix(getcontent($data[1].$uri));
// Log
#shell_exec ("echo Start ".$web." - ".$data[1].$uri." at ".date("m-d-y H:i:s")." >> /var/log/turincon");
// Get the URL Base
$base=my_urlbase($data[1]);
// Change relative to absolute URLs
$str=preg_replace('#(href|src|HREF|SRC)="([^:"]*)(?:")#','$1="'.$base.'$2"',$html);
// For Fix images in MSN Groups
$str=str_replace($base."/isapi/fetch.dll","http://groups.msn.com/isapi/fetch.dll",$str);
// Lowercase html tags
$str=lower_html_tags($str);
// Change internal URLs
// Detect if URL have end /
if (substr($data[1],strlen($data[1])-1)=="/") $slash="/";
// Make the replace
if (!strstr($data[1],"groups.msn"))
{
$str=str_replace('href="'.$data[1],'href="http://'.$web.'.turincon.com'.$slash,$str);
}
else
{
$parts=split("/",$data[1]);
$eurl=$parts[0]."//".$parts[2]."/".$parts[3]."//".$parts[3];
$str=str_replace('href="'.$eurl,'href="http://'.$_SERVER['HTTP_HOST'].$slash,$str);
}
// Some people add code after the