hi, i have written my own directory lister that automatically generates a link for the file
but there seems to be a problem with files or folders that contain spaces in there name
the script will only get the text before the first space and nothing after
can any1 see anything wrong with my script or is there a better way to list the files?
//Header Stuff!!!
$me = $_SERVER['PHP_SELF'];
$Apathweb = explode("/", $me);
$FileNm = array_pop($Apathweb);
$webpt = implode("/", $Apathweb);
$actuURL = "http://".$_SERVER['HTTP_HOST'].$webpt;
include("http://".$_SERVER['HTTP_HOST']."/manik/header.php");
// END OF HEADER STUFF!!!
$bleb = "http://".$_SERVER['HTTP_HOST']."/manik/images";
$fred = getcwd()."/";
$fredon = dirname($fred);
$dir4me = @opendir($fred) or header("Status: 404 Not Found");
while (false !== ($file = readdir($dir4me))) {
if ($file != "." && $file != ".." && $file !=".htaccess" && $file != ".htpasswrd" && $file != "index.php"&& $file != "index.html"&& $file != "manik.php" && $file != "~.htaccess" && $file != "~.passwrd" && $file != ".passwd"&& $file != "~passwd"&& $file != "~.passwd"&& $file != ".log") { /* Remeber To provent a certain file or filetype add it to this line*/
$len = filesize("$file");
echo "<p align=center>Title: $file";
echo "<p align=center>Size: $len (bytes) <br>";
echo "<p align=center><a href=$actuURL/$file><img border=0 onmouseover=roll_over('but1', '$bleb/dl_up.jpg') onmouseout=roll_over('but1', '$bleb/dl_dwn.jpg') src=$bleb/dl_dwn.jpg width=117 height=48 name=but1></a></p>";
echo "<hr>";
}
}
closedir($dir4me);
?>
</p><style type="text/css">
<!--
body {
background-color: #E0E0E0;
}
-->
</style>
<p align="center"></p>
<p align="center">Copyright © 2005 <a href="http://www.underground-vinyls.co.uk/manik/">Manik Script</a> v0.5 written by Stuart Bell<br>
<p></p>
<script language = "Javascript">
function roll_over(img_name, img_src)
{
document[img_name].src = img_src;
}
</script>
<script language=JavaScript>
<!--
var message="Sorry but Right Click has been disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
<?php
//Footer stuff
$me = $_SERVER['PHP_SELF'];
$Apathweb = explode("/", $me);
$FileNm = array_pop($Apathweb);
$webpat = implode("/", $Apathweb);
$actuURL = "http://".$_SERVER['HTTP_HOST'].$webpt."/".$FileNm;
include("http://".$_SERVER['HTTP_HOST']."/manik/footer.php");
// END of FOOTER STUFF!!!
?>
thanx in advanced 4 your replays