Jump to content

index?


dezkit

Recommended Posts

Or Simply put.. may want to change the colors around a bit.. but over all.. this should do the trick. can alter it over all to look like the Indexes Option.. but if you want more control over what the public may see then I would go with this.. but thats me.. (mind you if you have this for public viewing and not in a exclusively access able area you may want to remove the bit that contains code to delete listed files..)

 

<table border="0" cellpadding="3" cellspacing="3">
<tr><td bgcolor='#789ABC'><font color="#000000" size="2" face="Verdana"><a href='index.php?sortwhat=name' title='sort by 

name'><b>Name</b></a></font></td>
    <td bgcolor='#BAA978'><font color="#000000" size="2" face="Verdana"><a href='index.php?sortwhat=size' title='sort by 

size'><b>Size</b></a></font></td>
    <td bgcolor='#78CD9A'><font color="#000000" size="2" face="Verdana"><a href='index.php' title='sort by 

date/time'><b>Date/Time</b></a></font></td>

<?
$maindir = "../";
$mydir = opendir($maindir);

while($fn = readdir($mydir)){
  if ($fn == "." || $fn == ".." || $fn == "index.php"){continue;}
  else
  {
  $x++;
  $afn[$x]=$fn;
  if($sortwhat==""){$aft[$x]=filemtime($maindir.$fn);}
  if($sortwhat=="size"){$aft[$x]=filesize($maindir.$fn);}
  if($sortwhat=="name"){$aft[$x]=$fn;}
  }
}
arsort($aft, SORT_NUMERIC);
foreach ( $aft as $key => $value ) {
$fpn = $maindir.$afn[$key];
        if ($afn[$key] == "images") {
        echo "<tr><td bgcolor='#ABCDEF'><font size='1' face='Verdana'>".$afn[$key]."</font></td><td 

bgcolor='#FEDCBA'><font size='1' face='Verdana'> ---- </font></td><td bgcolor='#ABEFCD'><font size='1' face='Verdana'> 

File Marker </font></td></tr>";
  } else {
echo "<tr><td bgcolor='#ABCDEF'><font size='1' face='Verdana'><a href=".$fpn.">".$afn[$key]."</a></font></td><td 

bgcolor='#FEDCBA'><font size='1' face='Verdana'>".fsize($fpn)."</font></td><td bgcolor='#ABEFCD'><font size='1' 

face='Verdana'>".tdatetime(filectime($fpn))."</font></td><td><a 

href='index.php?loc=1&area=delhappic&pic=".$afn[$key]."'><font size='1' face='Verdana'>Delete</font></a></td></tr>";
}
}

closedir($mydir);

function tdatetime($ts){return date("F d Y H:i:s", $ts);}

function fsize($file){
$a = array("B", "KB", "MB", "GB", "TB", "PB");
$pos = 0;
$size = filesize($file);
while ($size >= 1024) {
$size /= 1024;
$pos++;
}
return round($size,2)." ".$a[$pos];
}

function foldersize($path){
$size = 0;
$dir = opendir($path);
while ($file = readdir($dir)){
if (is_file($path.$file)){$size=$size+filesize($path.$file);}
}
return $size;
}
echo "<tr><td bgcolor='#BBBBBB'><font size='1' face='Verdana'><b>Foldersize: </b></font></td><td bgcolor='#BBBBBB'><font 

size='1' face='Verdana'><b>".round((foldersize($maindir)/1024/1024),3)." MB</b></font></td><td bgcolor='#BBBBBB'><font 

size='1' face='Verdana'>......</font></td></tr>";
?>

</table>

 

if you should want to block specifics alter this piece to your needs in the above...

while($fn = readdir($mydir)){
  if ($fn == "." || $fn == ".." || $fn == "index.php"){continue;}
  else

 

example.. change index.php to what ever specific you want not shown.. or just add something to the line.. after "index.php" just put || $fn == "file.ext" its a crude method I suppose but its worked for me for some time when I need to use it..

Link to comment
Share on other sites

thanks guys but its not what i wanted :P

 

here is my website

i created a subdirectory (a)

i made a blank index.php (so u guys can give me the code)

i created a subdirectory (b) in that subdirectory, i made 2 random html files,

 

how do i look whats in subdirectory(b) by the index.php in subdirectory(a) ? :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.