php-windows Digest 3 Nov 2005 12:25:50 -0000 Issue 2812

Topics (messages 26455 through 26456):

Re: PHP web based administrator... Pyrite
        26455 by: trystano.aol.com

list files in a directory
        26456 by: JC Botha

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Wow! This is pretty cool!

So if we were to use it, how exactly would we tie it in with our own php.ini 
files?

Tryst

--- End Message ---
--- Begin Message ---
Dear Users, I need some help.

 

I got some directories on a web server, these I called with PHP to be
displayed on an HTML page. But I do not get them sorted properly. I want
them to be sorted by name and not by size. Could some one please shed some
light on this.

 

Thanks

 

 

============================================================================
===========

 

<?php

 

function disfile($dir, $file, $num, $status)

{

            $filelength = strlen($file);

            $disfile = substr($file, 0, ($filelength -3));

            if($status == 'true')

            {

                        $file_link .= "<INPUT TYPE=RADIO NAME=\"file_name\"
VALUE=\"$dir$file\"> $disfile<br>";

            }else{

                        $file_link .= "<li> <a href=\" $dir$file\"
target=\"_blank\">" . $disfile . "</a></li>";

                        //<font size=1>($filesizefile $term)</font><br>";

            }

            return $file_link;

}

 

function download($dir,$ms)

{

            if (isset($_GET['download']))

            {

                        header("Content-Type: octet/stream");

                        header("Content-Disposition: attachment; filename="
. basename($_GET['download']));

                        //echo file_get_contents($_GET['download']);

            } else {

                        if ($open = opendir($dir))

                        {

                                    $num = 0;

                                    while (false !== ($file =
readdir($open)))

                                    {

                                                if ($file != "." && $file !=
"..")

                                                {

                                                            //echo
"$file\n";

                                    

                                                            if (!is_dir($dir
. $file))

                                                            {

                                                                        $num
++;                                                                      

 
$folder_files .= disfile($dir,$file,$num,$ms);

                                                            }

                                                }

                                    }                                   

                        }

                        closedir($open);

            }

 

            return $folder_files;

}

 

 

 

?>

 

 

============================================================================
===========


--- End Message ---

Reply via email to