views:

53

answers:

1

Hi this code SHOULD put all segments into an array.

    $dir = "../www.cms.actwebdesigns.co.uk2/logged.php";
#$dir = "../../logged.php";

$str = base64_encode(htmlspecialchars(preg_replace("#(?:\s\s+)|(?:\n)|(?:\t)|(?:\r)#", " ", file_get_contents($dir))));
$dataToAdd = array();

for($x=0; true; $x++)
{
    if(preg_match("#(".base64_encode("<?php ").")((?!(".base64_encode("?> ").")).)*#is", $str, $match))
    {
        $dataToAdd[] = $match[0].base64_encode("?> ");
        $PQmatch = preg_quote($match[0].base64_encode("?> "), "#");
        $str = preg_replace("#".$PQmatch."#is", "", $str, 1);
    }
    else
    {
        break;
    }
}

$z=1;

foreach($dataToAdd as $data)
{
    echo "<xmp>".$z."----->>> ".base64_decode($data)."<br /></xmp>";    
    $z++;
}

//1----->>> &lt;?php include(&quot;scripts/php/auth.php&quot;); include(&quot;scripts/php/sessions.php&quot;); ?&gt;<br />
//2----->>> &lt;?php if($VERIFICATION!==1) { ?&gt;<br />
//3----->>> &lt;?php echo $WEBSITE; ?&gt;<br />
//4----->>> &lt;?php } ?&gt; &lt;/p&gt; &lt;/div&gt; &lt;div class=&quot;contentBlock&quot;&gt; &lt;h2&gt;ACT Web Designs Group&lt;/h2&gt; &lt;p&gt;&lt;a href=&quot;http://www.actwebdesigns.co.uk&amp;quot; title=&quot;link to ACT Web Designs Home&quot;&gt;www.actwebdesigns.co.uk&lt;/a&gt;&lt;br /&gt; &lt;a href=&quot;http://hosting.actwebdesigns.co.uk&amp;quot; title=&quot;link to ACT Web Designs Hosting Solutions&quot;&gt;www.hosting.actwebdesigns.co.uk&lt;/a&gt; &lt;a href=&quot;http://www.plugnplaycms.co.uk.co.uk&amp;quot; title=&quot;link to the home of plug n play cms&quot;&gt;www.plugnplaycms.co.uk&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id=&quot;mainBodyRight&quot;&gt; &lt;?php if(isset($_GET['msg']) &amp;&amp; !empty($_GET['msg'])) { echo &quot;&lt;div class=\&quot;contentBlock\&quot;&gt;\n&quot;; echo &quot;&lt;h2&gt;&quot;.$_GET['h2'].&quot;&lt;/h2&gt;&quot;; echo &quot;    &lt;p style=\&quot;color:&quot;.$_GET['color'].&quot;\&quot;&gt;&quot;.$_GET['msg'].&quot;&lt;/p&gt;\n&quot;; echo &quot;&lt;/div&gt;\n&quot;; } if($VERIFICATION==0) { issetJava(&quot;Your account needs verifying.&quot;, &quot;javascript&quot;, &quot;Authorisation&quot;, &quot;red&quot;); } elseif($VERIFICATION==1) { include(&quot;pageIncludes/install.php&quot;); } elseif($VERIFICATION==2) { include(&quot;pageIncludes/mainPage.php&quot;); } ?&gt;<br />

?>

The last output (4) should be split into 4 or 5 results but it isn't. n e one know why??

+1  A: 

Basically, your whole methodology is made of layers of craziness that are fighting with each other. I did this and it works:

<?
$file = '<?php include("scripts/php/auth.php"); include("scripts/php/sessions.php"); ?><?php if($VERIFICATION!==1) { ?><?php echo $WEBSITE; ?><?php } ?> </p> </div> <div class="contentBlock"> <h2>ACT Web Designs Group</h2> <p><a href="http://www.actwebdesigns.co.uk" title="link to ACT Web Designs Home">www.actwebdesigns.co.uk</a><br /> <a href="http://hosting.actwebdesigns.co.uk" title="link to ACT Web Designs Hosting Solutions">www.hosting.actwebdesigns.co.uk</a> <a href="http://www.plugnplaycms.co.uk.co.uk" title="link to the home of plug n play cms">www.plugnplaycms.co.uk</a></p> </div> </div> <div id="mainBodyRight"> <?php if(isset($_GET[\'msg\']) && !empty($_GET[\'msg\'])) { echo "<div class=\"contentBlock\">\n"; echo "<h2>".$_GET[\'h2\']."</h2>"; echo "    <p style=\"color:".$_GET[\'color\']."\">".$_GET[\'msg\']."</p>\n"; echo "</div>\n"; } if($VERIFICATION==0) { issetJava("Your account needs verifying.", "javascript", "Authorisation", "red"); } elseif($VERIFICATION==1) { include("pageIncludes/install.php"); } elseif($VERIFICATION==2) { include("pageIncludes/mainPage.php"); } ?>';

$str = preg_replace("#(?:\s\s+)|(?:\n)|(?:\t)|(?:\r)#", " ", $file);
$dataToAdd = array();

while(preg_match("#(<\?php .*?\?>)#is", $str, $match)) {
    $dataToAdd[] = $match[1];
    $PQmatch = preg_quote($match[1], "#");
    $str = preg_replace("#".$PQmatch."#is", "", $str, 1);
}

$z=1;
foreach($dataToAdd as $data) {
    echo "<xmp>".$z."----->>> ".$data."<br /></xmp>\n";
    $z++;
}
?>
chaos