Page 1 of 2

display the contenst

Posted: Sat Apr 02, 2005 12:15 pm
by VooDoo
http://home.comcast.net/~goofy4u273/

is my little corrner of the internet, but when i click on it i get a 404

how can i get it to display the files i have in there like this site does

http://www.gamers.org/pub/idgames2/levels/deathmatch/

me

Posted: Sat Apr 02, 2005 12:22 pm
by Jim Z
if you find out, please post the solution. I've been trying to figure this out myself. You used to be able to do this wth Comcast's hosting, I think they changed it about a year/year and a half ago.

Posted: Sat Apr 02, 2005 12:33 pm
by VooDoo
good it made sence. was not sure if it did :D

and will do

me

Posted: Sat Apr 02, 2005 1:03 pm
by Absolut Talent
you can write up a page in php or asp and have it include the directory contents. Then just set up the page as your index. Then when people visit, the page will include all the directorys as shown there.

Posted: Sat Apr 02, 2005 2:04 pm
by Busby
Or make sure there is no index.htm file (or any HTM files named main, default, index, etc.) and add a .htaccess file with the following lines:
Option Indexes FollowSymLinks
Then put that file in the root directory.

Posted: Sat Apr 02, 2005 4:55 pm
by VooDoo
what is a .htaccess file??

me

Posted: Sat Apr 02, 2005 6:35 pm
by FlyingPenguin
Make sure there is no indext.htm, index.html, default.htm or default.html file in the directory.

HOWEVER some web servers, for security reasons, don't show directories even without these files present.

Posted: Sat Apr 02, 2005 7:41 pm
by VooDoo
Originally posted by FlyingPenguin
Make sure there is no indext.htm, index.html, default.htm or default.html file in the directory.


there is not

me

Posted: Sun Apr 03, 2005 3:28 am
by Absolut Talent
Originally posted by FlyingPenguin
Make sure there is no indext.htm, index.html, default.htm or default.html file in the directory.

HOWEVER some web servers, for security reasons, don't show directories even without these files present.


and being the security driven force that Comcast is......thats what I was thinking they would do would be disabling it

Thats why I suggested using a asp or php based index page to have it manually list the contents. First thing would be to find out if your webspace supports one or the other. Easiest way would be to create a index.asp or index.php file and upload it. Then visit it on your space and see if it shows correctly

To test asp, open up notepad and type the following

Code: Select all

<% response.write "Asp works on this server" %>


Now save it. Make sure when you save, in notepad save as type "all files" and save it as a .asp file (so the filename would be something like "asptest.asp" without the quotes)

After saving, do the same thing again, this time write

Code: Select all

<?php
echo "Php works on this server";
?>


Do the same thing when you save it, except save it with a .php extention (so it would be "phptest.php", again without the quotes)


Upload those to your server, and try to view them. If they show up as a blank page with only the words "Asp works on this server" or "Php works on this server", then you know which types the server supports and you can write a file accordingly to show the directory contents

Posted: Sun Apr 03, 2005 4:19 am
by Absolut Talent
Did a little bit of writing...if your server can handle ASP based files, then you can use the below code. Just copy it all and paste it in notepad. Save it as a .asp file and upload it.
[php]<html>
<head>
<title></title>
<body>

<%
Dim strPathInfo, strPhysicalPath
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)

Dim objFSO, objFile, objFileItem, objFolder, objFolderContents
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
%>

<Table cellpadding=5>
<tr align=center>
<TH align=left>File Name</th>
<th>Type</th>
<th>File Size</th>
<Th>Last Modified</th>
</tr>

<%
For Each objFileItem in objFolderContents
%>

<TR>
<td align=left>
<a href="<%= objFileItem.Name %>">
<%= objFileItem.Name %>
</a>
</td>
<td align=right>
<%= objFileItem.type %>
</td>
<td align=right>
<%= objFileItem.size %>
</td>
<td align=right>
<%= objFileItem.DateLastModified %>
</td>
</tr>

<%
Next
%>

</table>
</body>
</html>[/php]


As for the php.....I am not quite sure as I am still in the process of learning enough of it to get by for now. WHat I write doesnt seem to work as Im getting errors on my while/if lines.....but there doesnt seem to be anything out of place in my code...but its late so I may be overlooking something

Posted: Sun Apr 03, 2005 6:48 am
by Busby
ASP is so gross and disgusting in my opinion.

Code: Select all

<?php

echo "




<table align='center' width='75%'>
  <tr>
    <td width='35%'><b>Filename</b></td>
    <td width='25%'><b>File Type</b></td>
    <td width='30%'><b>Last Modified</b></td>
    <td width='10%'><b>Size</b></td>
  </tr>
  <tr>\n
    <td width='35%'>&nbsp;</td>\n
    <td width='25%'>&nbsp;</td>\n
    <td width='30%'>&nbsp;</td>\n
    <td width='10%'>&nbsp;</td>\n
  </tr>\n";

$current = ".";
$filelist = array();
$directories = array();
$m = 0;
$j = 0;

if(is_dir($current)) {
    if($dh = opendir($current)) {
        while(($file = readdir($dh)) !== false) {
    if($file == ".") continue;
    else if($file == "..") {
    echo "
    <tr>\n
    <td width='35%'><a href='$file'>Parent Directory</a></td>\n
    <td width='25%'>--</td>\n
    <td width='30%'>--</td>\n
    <td width='10%'>--</td>\n
    </tr>\n";
    }
    else if(is_dir($file)) {
    $stats = stat($file);
    $mtime = $stats[9];
    $modified = date("g:i A F j, Y", $mtime);

    $dir = "<tr>\n
    <td width='35%'><a href='$file'>$file</a></td>\n
    <td width='25%'><b>Directory</b></td>\n
    <td width='30%'>$modified</td>\n
    <td width='10%'>--</td>\n
    </tr>\n";
    $directories[$j] = $dir;
    $j++;
    }
    else {
    $stats = stat($file);

    $filetype = mime_content_type($file);

    $mtime = $stats[9];
    $modified = date("g:i A F j, Y", $mtime);

    $size = $stats[7];
    $units = array(' B', ' KB', ' MB', ' GB', ' TB');
    for ($i = 0; $size > 1024; $i++) {
        $size /= 1024;
    }
    $finalsize = round($size,2);

    $filestuff = "
  <tr>\n
    <td width='35%'><a href='$file'>$file</a></td>\n
    <td width='25%'>$filetype</td>\n
    <td width='30%'>$modified</td>\n
    <td width='10%'>$finalsize $units[$i]</td>\n
  </tr>\n";
    $filelist[$m] = $filestuff;
    $m++;
    }
        }
    closedir($dh);
    }
}

for($k = 0; $k < count($directories); $k++) {
    echo "$directories[$k]";
}
for($l = 0; $l < count($filelist); $l++) {
    echo "$filelist[$l]";
}

echo "
</table>";

?>
The filetype column may or may not work depending upon the configuration of magic_mime. If not, let me know I can remove it. And if you want to see what the output looks like, <a href="http://128.61.49.173:8080/files/test.php">click here</a>.

*EDIT*

Stupid smilies ruining the increment of a variable.

*EDIT AGAIN*
It didn't handle directories very well so I fixed it. Should handle almost anything thrown at it.

Posted: Sun Apr 03, 2005 6:52 am
by Busby
Oh yeah here is an explanation of a HTACCESS file:

http://httpd.apache.org/docs-2.0/howto/htaccess.html

Posted: Sun Apr 03, 2005 8:03 am
by VooDoo
i maded all the files, them uploaded to comcast

with no luck guys, i tryed all but still got a 404

me

Posted: Sun Apr 03, 2005 8:31 am
by Busby
Ok I searched the FAQs and Comcast doesn't support PHP and/or ASP. You have enabled the Personal Web Pages service through the online thing Comcast has right? If so then it is a file that is blocking access. Also, are you using the Online Storage feature or the PWP feature? If you are using [url]ftp://upload.comcast.net[/url] then that is the Online Storage and not the Personal Web Page feature.

Posted: Sun Apr 03, 2005 2:13 pm
by Absolut Talent
Originally posted by Busby
ASP is so gross and disgusting in my opinion.


well....i still have mixed feelings about it. But it is what I started out learning, so its easier for me to write it over PHP. But in the long run, I will agree that PHP is better for so much more