I am not getting any errors but I am having some incredibly weird issues, like being able to redirect after sending text and not getting any errors even though I set a session after sending data.
Can anyone give me a clue as to what the heck is going on? It’s probably really simple but I am stumped.
NOTE!!! I have apache set to pull one specific file regardless of the URL. The code below, determines whether or not to send an index page. The Apache setting is as follows.
Code: Select all
DirectoryIndex /sys.phpCode: Select all
this is a header killer
<?php
session_start();
function HideIt($WhatThis)
{
$Matched = false;
$HideIt = array("index.php", "RECYCLER", "System Volume Information", "Thumbs.db", "Desktop.ini", "sys.php");
$ShouldI = @str_replace($HideIt, "", $WhatThis);
// see if there was any matches
if ($WhatThis != $ShouldI) $Matched = true;
return $Matched;
}
$DirectoryToOpen = $_SERVER['REQUEST_URI'];
?>
<html>
<head>
<title>Welcome To System One</title>
</head>
<body>
<p><b>systemone<?php echo str_replace("%20", " ", $_SERVER['REQUEST_URI']); ?></b></p>
<pre>
<?php
// LOOP THROUGH ALL DIRECTORIES
if ($handle = opendir(str_replace("%20", " ", $DirectoryToOpen)))
{
while (false !== ($file = readdir($handle)))
{
if (HideIt($file) != true)
{
if (is_dir(str_replace("%20", " ", $DirectoryToOpen) . $file))
{
echo '<a href="http://localhost' . $DirectoryToOpen . $file . '">' . $file . "</a>\n";
}
}
}
closedir($handle);
}
// LOOP THROUGH ALL FILES
if ($handle = opendir(str_replace("%20", " ", $DirectoryToOpen)))
{
while (false !== ($file = readdir($handle)))
{
// if there is an index.php file in the requested directory we stop everything and send that instead
if (($file == "index.php") or ($file == "index.htm") or ($file == "index.html"))
{
echo "Location: http://localhost" . $DirectoryToOpen . $file;
//while (@ob_end_clean());
header("Location: http://localhost" . $DirectoryToOpen . $file);
exit;
}
if (HideIt($file) != true)
{
if (!is_dir(str_replace("%20", " ", $DirectoryToOpen) . $file))
{
echo '<a href="http://localhost' . $DirectoryToOpen . $file . '">' . $file . "</a>\n";
}
}
}
closedir($handle);
}
?>
</pre>
</body>
</html>
<!-- FILE ID sys.php -->Code: Select all
error_reporting = E_ALLCode: Select all
this is a header killer
<html>
<head>
<title>Welcome To System One</title>
</head>
<body>
<p><b>systemone/</b></p>
<pre>
<a href="http://localhost/complete">complete</a>
<a href="http://localhost/documents">documents</a>
<a href="http://localhost/Enterprise">Enterprise</a>
<a href="http://localhost/Games">Games</a>
<a href="http://localhost/manuals">manuals</a>
<a href="http://localhost/media">media</a>
<a href="http://localhost/menu">menu</a>
<a href="http://localhost/projects">projects</a>
<a href="http://localhost/Software">Software</a>
<a href="http://localhost/Virtual Cds">Virtual Cds</a>
<a href="http://localhost/Jason Webb.mov">Jason Webb.mov</a>
</pre>
</body>
</html>
<!-- FILE ID sys.php -->Can someone please tell me what is going on with that? Even when I changed the apache server configuration to pull index.php as the default page, and renamed sys.php to index.php there were no errors, however, the only code that it output was as follows...
Code: Select all
<a href="e;http://localhost/Jason Webb.mov"e;>Jason Webb.mov</a>
</pre>
</body>
</html>
<!-- FILE ID index.php -->