Uh oh... the RIAA will be knocking on your door in about 17 minutes....
On Mar 18, 2004, at 1:21 AM, Alvaro Zuniga wrote:
> Hi Everyone:
> A fried visited me today and we had a few drinks. He listened to some
> of
> my music and asked me if I could possibly display it online for him to
> download. After he left, I wrote this algorithm that is very short
> thanks to the power of recursion. I just wanted to shae it.
>
> For the computer scientists out there, yes I know about the recursion
> so
> show your alternative :-)
>
> enjoy,
>
> Alvaro Zuniga
>
> <?php
> global $path;
> $path = '';
> rec_index( $file );
> function rec_index( $file ) {
> global $path;
> if( is_file( $file ) ) {
> $mp3 = explode( '.', $file );
> if( $mp3[count( $mp3 ) - 1] == 'mp3' ) {
> echo '<a href="' . $path . $file . '">' . $file . '</a><br>';
> }
> }
> elseif( ( is_dir( $file ) && $file != '.' && $file != '..' ) ||
> $file
> == '' ) {
> $path .= $file . '/';
> if( $file ) chdir( $file );
> echo '<b>' . $file . '</b><br><blockquote>';
> $handle = opendir( '.' );
> while( ( $file = readdir( $handle ) ) !== false ) {
> rec_index( $file );
> }
> chdir( '..' );
> echo '</blockquote>';
> }
> }
> ?>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://brlug.net/mailman/listinfo/general_brlug.net
>
--
Shannon Roddy
LIGO - Caltech
225.686.3106 (work)
225.933.7821 (cell)
[EMAIL PROTECTED]