Hello this is my first attempt at a flat download script but how would i make it scan directories and download the downloads on a new page instead of that same page ? or any other features that come on todays standard download scripts.
Please consider that i am still new to programming so please explain any code that you post if you dont mind thanks
///////////////////////////This is my index.php of the downloads script :
<?php
include("core.php");
for($i = 0; $i < count($files); $i++) {
$files = str_replace(" ", "%20", $files);
if(is_dir($files[$i]) | is_dir($filename[$i])){
} else {
echo "<a href=" . "http://localhost/killerphp/download%20script/" . "$files[$i]" . ">$filename[$i]</a>";
$size = round(filesize($filename[$i])/1024);
echo " $size" . "KB" . "<br />";
}
}
for($i = 0; $i < count(is_dir($dir))); $i++) {
}
?>
//////////////////////////////////This is my core.php of the downloads script
<?php
$dir = getcwd();
$files = scandir($dir);
$remove = array("index.php","core.php");
$files = array_diff($files, $remove);
$filename = scandir($dir);
$remove = array("index.php","core.php");
$filename = array_diff($filename, $remove);
$directory = scandir(readdir($dir));
echo "$directory";
?>
//////////////////////////////////
Please ignore
$directory = scandir(readdir($dir));
echo "$directory";
and
for($i = 0; $i < count(is_dir($dir))); $i++) {
}
i was just messing around to try see if i could make it scan directories...thanks in advanced
Please consider that i am still new to programming so please explain any code that you post if you dont mind thanks
///////////////////////////This is my index.php of the downloads script :
<?php
include("core.php");
for($i = 0; $i < count($files); $i++) {
$files = str_replace(" ", "%20", $files);
if(is_dir($files[$i]) | is_dir($filename[$i])){
} else {
echo "<a href=" . "http://localhost/killerphp/download%20script/" . "$files[$i]" . ">$filename[$i]</a>";
$size = round(filesize($filename[$i])/1024);
echo " $size" . "KB" . "<br />";
}
}
for($i = 0; $i < count(is_dir($dir))); $i++) {
}
?>
//////////////////////////////////This is my core.php of the downloads script
<?php
$dir = getcwd();
$files = scandir($dir);
$remove = array("index.php","core.php");
$files = array_diff($files, $remove);
$filename = scandir($dir);
$remove = array("index.php","core.php");
$filename = array_diff($filename, $remove);
$directory = scandir(readdir($dir));
echo "$directory";
?>
//////////////////////////////////
Please ignore
$directory = scandir(readdir($dir));
echo "$directory";
and
for($i = 0; $i < count(is_dir($dir))); $i++) {
}
i was just messing around to try see if i could make it scan directories...thanks in advanced
Comment