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  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
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!


    NEW! Achieving True Agility -- How process can change the behavior of your tools

    Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools.
    FREE! Go There Now!


    NEW! Evaluate WebSphere Extended Deployment Compute Grid V6.1

    Visit IBM developerWorks to download a free trial version of WebSphere Extended Deployment Compute Grid, which lets you schedule, execute, and monitor batch jobs. Because online transaction processing and batch jobs execute simultaneously on the same server resources, you can avoid costly duplication of resources. Compute Grid supports job types of Java transactional batch, compute-intensive and a new type called "native execution", which enables non-Java workloads to run on distributed end points.
    FREE! Go There Now!


    Role of Integrated Requirements Management in Software Delivery

    As organizations integrate software into every aspect of business, they are constantly pressured to deliver faster, better, and cheaper results. Unfortunately, a “dis-integrated” software delivery approach reduces returns while increasing costs. This IBM Rational White Paper shows how Integrated Requirements Management aligns organizations around maximizing value and keeping pace with change.
    FREE! Go There Now!


    NEW! Whitepaper: Achieving consistency between business process models and operational guides

    Explore how Rational and WebSphere software enable enterprise documentation in SOA environments. Specifically, a new integration between IBM WebSphere® Business Modeler and IBM Rational® Method Composer software can help technical writers more easily keep enterprise operations manuals in sync with changes that are made to business processes, resulting in more accurate and timely documentation that benefits the entire enterprise.
    FREE! Go There Now!


    NEW! Section 508 of the U.S. Rehabilitation Act: Web accessibility compliance

    Because access to government information continues to be an area of concern for many U.S. citizens with disabilities, the U.S. government enacted Section 508 of the Rehabilitation Act in 2001 to ensure that government agencies create accessible Web content, enabling all citizens to access the information they need. A fully accessible Web site makes Web content accessible to all individuals, including those with disabilities, who may be accessing Web content via a variety of user agents. Common user agents include standard Web browsers, text-only browsers, assistive devices and mobile devices such as cell phones or personal digital assistants (PDAs).
    FREE! Go There Now!


    NEW! Improve your build process with IBM Rational Build Forge, Part 2: Automate builds for a real-world Tomcat project

    Learn how Rational Build Forge can extend a simple compile and package build process by adding customization and deployment capability. Go from a manual method to automating: checking for code changes; getting the latest source; compiling and packaging; customizing; copying to and restarting a deployment server; and sending e-mail notification that a new version is available.
    FREE! Go There Now!


    IBM – Taking Web 2.0 to Work

    You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Rational Talks to You: Scott Ambler on being agile in a global development environment

    Join this Rational Talks to You teleconference on December 6 at 1:00 pm ET to participate in an agile application development discussion and get your questions answered on using IBM Rational Method Composer in a distributed environment.Get your questions answered!
    FREE! Go There Now!


    NEW! Download a free trial of Lotus Quickr 8.0

    Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications.
    FREE! Go There Now!


    NEW! Run your first CICS application on a PC using TXSeries for Windows

    Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    MISCELLANEOUS CODE ARTICLES

    - A Web App Based on a Model for the CodeIgnit...
    - Completing a Model for the CodeIgniter PHP F...
    - Validating Input Data with the CodeIgniter P...
    - Deleting Database Records with the CodeIgnit...
    - Inserting Database Records with a CodeIgnite...
    - Fetching Database Rows with a Model for the ...
    - Model Data and Validation Rules for a Generi...
    - Building a Generic Model for the CodeIgniter...
    - 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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek