Files
404.php
404.phps.sit
404.phps.tar.gz
404.phps.zip
cli_urldecode_and_encode.php
create_password.phps
days_since.php
days_since.phps
index.php
intune.php
intune.phps
listing.phps
newsscript.php
newsscript.sit
newsscript.tgz
newsscript.zip
newsscript_faq.php
phptunest-search.zip
phptunest.zip
urldecode.php
urldecode_or_urlencode.php.sit
Directories
demonews
oldversions
sympoll

The code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Directory listing</title>
<style type="text/css" media="screen">
body {
    background-color: #FFF;
    color: #000;
    font-family: Geneva, Arial, sans-serif;
    font-size: 100%;
    line-height: 140%;
}
.grey1 { background-color: #CCC; }
.grey2 { background-color: #DDD; }
</style>
</head>
<body>
<table border="1" cellspacing="0" cellpadding="2">
<?php
function usecolor()
{
    static 
$colorvalue;

    
$trcolor1 "grey1";
    
$trcolor2 "grey2";
    
    if(
$colorvalue == $trcolor1)
        
$colorvalue $trcolor2;
    else
        
$colorvalue $trcolor1;
    return(
$colorvalue);
}


function 
test()
{
    
$default_dir "./";
    if(!(
$dp opendir($default_dir))) die("Cannot open $default_dir.");
    while(
$file readdir($dp)) $filenames[] = $file;
    
closedir($dp);
    
sort($filenames);
    echo 
"<tr><th>Files</th></tr>\n";
    for(
$i=0$i count($filenames); $i++)
    {
        if(
$filenames[$i] != 'listing.php' && !preg_match('/^\./',$filenames[$i]) && !is_dir($filenames[$i]))
        
// don't show directories, listing.php and files that start with a dot
          
echo "<tr><td class=\"" usecolor() . "\"><a href=\"" rawurlencode($filenames[$i]) . "\">"$filenames[$i] . "</a></td></tr>\n";
    }
    echo 
"<tr><th>Directories</th></tr>\n";
    for(
$i=0$i count($filenames); $i++)
    {
        if (
is_dir($filenames[$i]) && !preg_match('/^\./',$filenames[$i]))
        
// do show directories but not files and exclude everything that starts with a dot
        
echo "<tr><td class=\"" usecolor() . "\"><a href=\"" rawurlencode($filenames[$i]) . "\">"$filenames[$i] . "</a></td></tr>\n";
    }
}

test();
?>
</table>
</body>
</html>