Popups from links
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Popups from links

From: Bill Ray <bill@billraydrums.com>
Date: Fri Mar 31 2006 - 05:46:46 CEST

Heya all

I have a script that allows my website to display the contents of a
folder as links. I want those links to open as their MIME type (MP3
files) in a small window, displaying that file's name as an H2 tag.

Can someone help me out? Here's the script that I have:

$imagepath="/media/mp3s/new_tunes";
$realpath=$_SERVER['DOCUMENT_ROOT']."$imagepath";
$n=0;
$list=array();
if ($dir = @opendir($realpath)) {
        while (($file = readdir($dir)) !== false) {
                if(is_file("$realpath/$file") && ($file!=".htaccess")){
                        $n++;
                        $list[]=$file;
                }
        }
        closedir($dir);
        natcasesort($list);
        echo "<p>$n Files:</p>\n";
        echo "<ul>\n";
        for ($i=0;$i<count($list);$i++){
                $x=$i+1;
                echo "<li>";
                echo "<a href=\"$imagepath/$list[$i]\">$list[$i]</a>";
                echo "</li>\n";
        }
        echo "</ul>";
}

Any help would be mucho appreciated!

~B
Received on Mon May 1 02:45:30 2006