Miscellaneous Code
  Home arrow Miscellaneous Code arrow Music Library
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
JMSL Numerical Library 
IBM® developerWorks
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS CODE

Music Library
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2002-10-08

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    This is for use on a home computer with many MP3s stored on it. It will print out a list of the MP3s in a given directory (to change the directory, change the definition of $default_dir). The page will display a list of the files with each name acting as a link to the file so that it can be played. Of course, some individual modifications must be added to prevent it from echoing out files such as resume.dat or incomplete files, but these need to be added by the user for his/her individual setup. Also added are the shuffle, alphabetical, and reverse alphabetical sorters as well as the option to list incomplete files and the ability to search the files. It is also possible to navigate the directory heirarchy and folders are conveniently listed in bold. PHP must be installed for this code to work. Check back often as I am continuing to update the code and add new features. - Kate, webmaster@griflet.com

    By : kate2587

    <html><head>

    <title>Music Library</title>

    <style type="text/css">
    a {text-decoration: none; color: navy;}
    a:hover {text-decoration: underline; color: black;}
    body, a {font-family: 'Trebuchet MS'; font-size: 10pt;}
    </style>

    </head>

    <body>

    <center>

    <h1>Music</h1>
    <br>
    </center>

    <table border="0" width="100%">
    <tr><td width="75%" valign="top">
    <center>
    <b><span style="color: black; size: 12;">song list</span></b><br><br>
    </center>
    <?php
    $default_dir = "C:\\program files\\napster\\music";

    if (!(isset($searchFor)) && !(isset($sort_order))) {$display = "all";}
    $allEnds = "sort_order=$sort_order&include=$include&searchFor=$searchFor&search=$search&display=$display&dir=$dir";
    if (empty($dir)) {$dir = $default_dir;}

    $dp = opendir($dir);

    if (empty($searchFor)) {$display = "all";}

    if (ereg("\\\\",$dir))
    {
    $dir2 = str_replace("\\\\","\\",$dir);
    if (isset($dir2))
    {
    $dir = $dir2;
    }
    }

    while($file = readdir($dp)) $filenames[] = $file;

    if (($sort_order == "alphabetical") || !(isset($sort_order)))
    { sort($filenames);
    $sort_order = "alphabetical"; }
    else if ($sort_order == "shuffle")
    { shuffle($filenames); }
    else if ($sort_order == "reverse_alphabetical")
    { rsort($filenames); }
    for($i = 0; $i < count($filenames); $i++)
    {
    $file = $filenames[$i];
    if (
    (($include == "0") && ((eregi("incomplete", $file)))) ||
    ($file == ".") ||
    !(($display == "all") || (($search == "1") && ($searchFor != "") && (eregi("$searchFor", $file))))
    )
    {}
    else
    {
    if ((eregi(".+\.[A-Z0-9]{3,4}",$file)) || (eregi(".+\.com",$file)))
    {
    if (ereg(".mp3",$file)) {$parts = explode(".mp3", $file);} else if (ereg(".MP3", $file)) {$parts = explode(".MP3", $file);} else if (ereg(".mP3", $file)) {$parts = explode(".mP3", $file);} else {$parts = explode(".Mp3", $file);}
    echo "<a href=\"$dir\\$file\"";
    if (!(eregi(".mp3",$file))) {echo " target=\"_blank\"";}
    echo ">$parts[0]</a><br>\n";
    }
    else
    {
    if ($file == "..")
    {
    echo "<a href=\"$PHP_SELF?dir=$dir\\..\"><b><i>Above Directory</i></b></a><br>\n";
    }
    else
    {
    echo "<a href=\"$PHP_SELF?dir=$dir\\$file\"><b>$file</b></a><br>\n";
    }
    }
    }
    }

    ?>
    </td>

    <td width="25%" valign="top">
    <center>
    <b><span style="color: black; size: 12;">sort order</span></b><br><br>

    <a href="<?php echo "$PHP_SELF?$allEnds&sort_order=alphabetical";?>">alphabetical</a><br><br>
    <a href="<?php echo "$PHP_SELF?$allEnds&sort_order=reverse_alphabetical";?>">reverse alphabetical</a><br><br>
    <a href="<?php echo "$PHP_SELF?$allEnds&sort_order=shuffle";?>">shuffle</a><br><br>

    <?php
    if ($include == "1")
    { $newinclude = "0"; }
    else
    { $newinclude = "1"; }


    echo "<br><br><form>";
    echo "<a href=\"";
    echo "$PHP_SELF?$allEnds&include=$newinclude";
    echo "\"><input type=\"checkbox\"";
    if ($newinclude == "0")
    {echo " checked";}

    echo "> Include incomplete files (these files may not be playable)</a>
    </form>";

    ?>

    <br><br>

    <form action="<?php echo $PHP_SELF; ?>" method="get">
    <input type="text" name="searchFor" value="<?php if (isset($searchFor)) {echo $searchFor;}?>">
    <input type="hidden" name="include" value="<?php echo $include; ?>">
    <input type="hidden" name="sort_order" value="<?php echo $sort_order; ?>">
    <input type="hidden" name="dir" value="<?php echo $dir; ?>">
    <input type="hidden" name="search" value="1">
    <input type="submit" value="search" style="border-width: 1; border-color: black; font-color: black; background: white; font-family: 'trebuchet ms';">
    </form>

    <a href="<?php echo "$PHP_SELF?sort_order=$sort_order&include=$include&display=all&dir=$dir";?>">display all</a>

    <br><br>

    <a href="<?php echo "$PHP_SELF?sort_order=alphabetical&include=0"; ?>">Default Directory</a>
    </center>


    </body>
    </html>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Miscellaneous Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    Build Forge Express demo: Enabling software delivery excellence for small and midsized businesses

    This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process.
    FREE! Go There Now!


    NEW! BlammoSplat: Build a community Web site of OpenLaszlo animations, Part 3: The community animation

    Learn to enable users to both rate existing animations and to combine existing animations into new snippets. This is the third in a series of three tutorials that chronicle the building of a site that enables collaborative discussion and animation building using Domino and OpenLaszlo.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Developer for System i V7.1

    Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications.
    FREE! Go There Now!


    NEW! Evaluate Rational Host Access Transformation Services (HATS) Toolkit V7.1

    Visit IBM developerWorks to download a free trial of the Rational Host Access Transformation Services (HATS) Toolkit. The HATS toolkit provides a set of plug-ins for the IBM Rational Software Delivery Platform to help you easily extend your legacy applications. HATS makes your 3270 and 5250 applications available as HTML through the most popular Web browsers, while converting your host screens to a Web look and feel and it also enables you to develop new Web, portal, and rich-client applications.
    FREE! Go There Now!


    NEW! Hello World: WebSphere Service Registry and Repository

    Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services.
    FREE! Go There Now!


    NEW! Rational Talks to You: Manage RUP-based CMMI initiatives

    Join this Rational Talks to You teleconference on December 4 at 1:00 pm ET to discuss how Rational Method Composer can help meet your compliance objectives. Get your questions answered!
    FREE! Go There Now!


    NEW! Rational Testing eKits

    Discover how Rational tools and best practices for testing can make your job easier. The new Rational Testing eKits provide you with valuable resources – including demos, webcasts, tutorials, and articles – that help you address your specific testing needs across the software lifecycle. Five new eKits are available covering the topics of Requirements and Test Management, Functional Testing, Performance Testing, Code Quality and Embedded Systems, and SOA and Web Services Testing.
    FREE! Go There Now!


    NEW! Software Change and Configuration Management Solution Guidelines

    This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Process

    Visit IBM developerWorks to try the IBM SOA Sandbox for process. The SOA Sandbox for process focuses on providing a trial environment with the necessary tooling and components required to gain a better understanding of business processes and how to best improve existing business processes to derive value quickly.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    MISCELLANEOUS CODE ARTICLES

    - upload image to database sql
    - Random Password Generator
    - BCroot, get the root of a number with BC fun...
    - Find pi in a high precision
    - [PHP5] FORMCHECKER : data validation
    - SPL and ITERATOR : examples
    - Xml with Rss Feeds
    - [PHP5] NOTIMEOUT PACKAGE
    - Class to return variables to a Flash movie.
    - BCGCD Greatest Common Denominator (Large Num...
    - HMAC
    - Binary to Decimal
    - Decimal to Binary using logs
    - web.framework v1.0.0
    - Shopping Cart Class






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway