Full-service Internet Marketing & Web Development
Recent Posts

Sponsors
![]() |
filelister phpCode Wizard, 12-30-2006 |
this is an useful code to have if you got an archive with alot of files, you can create an file called 'scripts.php' and this code will put all files in a very nice table, you can also use a stylesheet to make it better, and you can than include 'scripts.php' in any of your php's to display your files, very smart for small or big sites.
i hope you figure out of to use it.
<table border="1" bordercolor="#000000" align="center"><tr bgcolor="#000000"><td><font color="#FFFFFF">Name</font></td><td><font color="#FFFFFF">Size</font></td></tr>
<?php
// ************************************************** ***//
// //
// Author - System33r- http://www.venomx.com //
// root@secone.com //
// //
// For a Demo, go to: //
// http://www.system33r.org/products/ //
// This script works on the "ls" command, and only //
// works on unix systems. Displays the File Name as a //
// link, and the size. Use, copy, distribute, i dont //
// care, no credit required. //
// ************************************************** ***//
exec("ls -la $dir",$lines,$rc);
$count = count($lines) - 1;
for ($i = 1; $i <= $count; $i++) {
$type = substr($lines[$i],0,1);
$name = strrchr($lines[$i]," ");
$name = substr($name,1);
$dire = substr($lines[$i],0,strpos($lines[$i],$name));
// echo "$dire</font>"; //
if ($type == "d") {
if ($name == "." or $name == "..") {
;
} else {
if ($dir == "") {
$size=filesize($name);
echo "<tr bgcolor="#FFFFFF"><td><a href="$name">$name</a></td><td>$size</td></tr>";
} else {
$size=filesize($name);
echo "<tr bgcolor="#FFFFFF"><td><a href=$dir/$name>$name</a></td><td>$size</td></tr>";
}
}
} else {
if ($dir == "") {
$size=filesize($name);
echo "<tr bgcolor="#FFFFFF"><td><a href=$name>$name</a></td><td>$size</td></tr>";
} else {
echo "<tr bgcolor="#FFFFFF"><td><a href=$dir/$name>$name</a></td></tr>";
}
}
}
?>
</table><br>
|
|
Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments

