I'm just trying something else now:
=====
function selfURL() {
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2) {
return substr($s1, 0, strpos($s1, $s2));
}
function GetTrueVars($text, $xhtml = true)
{
$tags = array(
'#(.*?)PageParser.php?file=(.*?)&(.*?)#si' => '?\\3',
'#(.*?).php?(.*?)#si' => '\\2',
);
foreach ($tags AS $search => $replace)
{
$text = preg_replace($search, $replace, $text);
}
return $text;
}
function ShootNumbers($text, $xhtml = true)
{
$tags = array(
'#&12(.*?)#si' => '&somefunnyrandomnumbersforajoke=',
);
foreach ($tags AS $search => $replace)
{
$text = preg_replace($search, $replace, $text);
}
return $text;
}
function FinalBitOfURL($text, $xhtml = true)
{
$tags = array(
'#http://www.(.*)/(.*)/(.*).php(.*)#si' => '\\2/',
);
foreach ($tags AS $search => $replace)
{
$text = preg_replace($search, $replace, $text);
}
return $text;
}
function LastDitchAttempt($text, $xhtml = true)
{
$tags = array(
'#http://(.*)//(.*)#si' => 'http://\\1/\\2',
);
foreach ($tags AS $search => $replace)
{
$text = preg_replace($search, $replace, $text);
}
return $text;
}
$Location = selfURL();
$AllVars = GetTrueVars($Location);
//echo $AllVars;
//echo "<br>";
$Combo = $file . $AllVars;
//echo $Combo;
//echo "<br>";
$NewCombo = ShootNumbers($Combo);
//echo $NewCombo;
//echo "<br>";
$GetFolders = FinalBitOfURL($Location);
//echo $GetFolders;
//echo "<br>";
$WebAddress = "http://".$_SERVER['SERVER_NAME']."/".$GetFolders."/".$NewCombo;
$StripTheCrap = LastDitchAttempt($WebAddress);
//echo $WebAddress;
//echo "<br>";
echo $StripTheCrap;
echo "<hr>";
// if(!$file == "" && (strstr($file,"?")))
// {
// $reg_ex = '?';
// $replace_word = "&";
// $OpenFile = ereg_replace($reg_ex, $replace_word, $file);
// }
// else { $OpenFile = $file;}
// echo $OpenFile;
ob_start();
include($StripTheCrap);
$string = ob_get_contents();
ob_end_clean();
echo $string;
echo '<iframe src="'.$StripTheCrap.'" scrolling="auto" style="height:80%; width:80%;">
Content
</iframe>';
===
What this is trying to do is get the full url of the page, then strip back the domian name and page, and the FILE variable if set, so just the other variables remain... and then build the URL of the file to include in the Buffer area. This is presently now in place for the example links in the above post - BUT for some reason the include now fails!
This bit of script is a bit messy, but the output page SHOULD first show the "real" URL of the page being shown, then display the contents of that page, followed by an iframe again containing that content. However, the only bit that works is displaying the real url.
- example <snip>
will display <snip> as the URL on the first line of the page... changing the & to a ? also changes it within the page. But the INCLUDE function should be working as the file is there.
This is really bugging me now.
[edited by: dreamcatcher at 6:46 am (utc) on Feb 6, 2010]
[edit reason] no urls please, see T.O.S [/edit]