display the contenst

Discussions about anything Computer Hardware Related. Overclocking, underclocking and talk about the latest or even the oldest technology. PCA Reviews feedback
VooDoo
Golden Member
Posts: 1553
Joined: Sat May 04, 2002 6:31 pm
Location: earth
Contact:

display the contenst

Post 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
guess i need a new one...
Jim Z
Golden Member
Posts: 969
Joined: Thu Mar 15, 2001 9:22 pm
Location: MI

Post 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.
VooDoo
Golden Member
Posts: 1553
Joined: Sat May 04, 2002 6:31 pm
Location: earth
Contact:

Post by VooDoo »

good it made sence. was not sure if it did :D

and will do

me
guess i need a new one...
Absolut Talent
Almighty Member
Posts: 2868
Joined: Mon Jan 07, 2002 12:30 pm

Post 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.
User avatar
Busby
Golden Member
Posts: 1890
Joined: Tue Nov 28, 2000 6:25 pm
Location: Atlanta Area, GA, USA
Contact:

Post 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.
<a href="mailto:busby1218@charter.net">
<img src="http://justinbusby.com:8080/signature.gif" border="0"></a>
VooDoo
Golden Member
Posts: 1553
Joined: Sat May 04, 2002 6:31 pm
Location: earth
Contact:

Post by VooDoo »

what is a .htaccess file??

me
guess i need a new one...
User avatar
FlyingPenguin
Flightless Bird
Posts: 33162
Joined: Wed Nov 22, 2000 11:13 am
Location: Central Florida
Contact:

Post 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.
---
“The Government of Spain will not applaud those who set the world on fire just because they show up with a bucket.” - Prime Minister of Spain, Pedro Sánchez

Image
VooDoo
Golden Member
Posts: 1553
Joined: Sat May 04, 2002 6:31 pm
Location: earth
Contact:

Post 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
guess i need a new one...
Absolut Talent
Almighty Member
Posts: 2868
Joined: Mon Jan 07, 2002 12:30 pm

Post 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
Absolut Talent
Almighty Member
Posts: 2868
Joined: Mon Jan 07, 2002 12:30 pm

Post 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
User avatar
Busby
Golden Member
Posts: 1890
Joined: Tue Nov 28, 2000 6:25 pm
Location: Atlanta Area, GA, USA
Contact:

Post 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.
<a href="mailto:busby1218@charter.net">
<img src="http://justinbusby.com:8080/signature.gif" border="0"></a>
User avatar
Busby
Golden Member
Posts: 1890
Joined: Tue Nov 28, 2000 6:25 pm
Location: Atlanta Area, GA, USA
Contact:

Post by Busby »

Oh yeah here is an explanation of a HTACCESS file:

http://httpd.apache.org/docs-2.0/howto/htaccess.html
<a href="mailto:busby1218@charter.net">
<img src="http://justinbusby.com:8080/signature.gif" border="0"></a>
VooDoo
Golden Member
Posts: 1553
Joined: Sat May 04, 2002 6:31 pm
Location: earth
Contact:

Post by VooDoo »

i maded all the files, them uploaded to comcast

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

me
guess i need a new one...
User avatar
Busby
Golden Member
Posts: 1890
Joined: Tue Nov 28, 2000 6:25 pm
Location: Atlanta Area, GA, USA
Contact:

Post 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.
<a href="mailto:busby1218@charter.net">
<img src="http://justinbusby.com:8080/signature.gif" border="0"></a>
Absolut Talent
Almighty Member
Posts: 2868
Joined: Mon Jan 07, 2002 12:30 pm

Post 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
Post Reply