Need to display a directory on a page kinda
17 posts
• Page 2 of 2 • 1, 2
in here...
- Code: Select all
// Define the full path to your folder from root
$path = "/hsphere/local/home/";
what type of server are you running. if its linux it needs to be as such above...
/ ---root directory
/www/ ---www directory in root
/www/mysite.com/ --- mysite.com in www in root... and so on.
for windows it would be like.. C:\www\mysite.com
if you dont know this you can ask your host. and if you have SSH access to your server then you can login and type ~ to go to root, and find your way to your site ( thats what i did ). just dont snoop around into other sites on that server, or try to get into system files.. they should be locked by root ( if its linux ) however they do make a log of what you tried to do.
Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in /home/tournam4/public_html/Downloads/index.php on line 41
????^
- xxsonyboy4lfexx
- Posts: 315
- Joined: Sat Jan 07, 2006 4:42 pm
- Location: California
your code looks as follows?
- Code: Select all
<?
/**
* Change the path to your folder.
*
* This must be the full path from the root of your
* web space. If you're not sure what it is, ask your host.
*
* Name this file index.php and place in the directory.
*/
// Define the full path to your folder from root
$path = " /home/tournam4/public_html/Downloads/";
// Open the folder
$dir_handle = @opendir($path) or die("Unable to open $path");
// Loop through the files
while ($file = readdir($dir_handle)) {
if($file == "." || $file == ".." || $file == "index.php" )
continue;
echo "<a href="$file\">$file</a><br>";
}
// Close
closedir($dir_handle);
?>
i am just kinda wondering if there should be a /local/ in that line?
so it would look /local/home/tournam4/public_html/Downloads/
making the code look like
so it would look /local/home/tournam4/public_html/Downloads/
making the code look like
- Code: Select all
<?
/**
* Change the path to your folder.
*
* This must be the full path from the root of your
* web space. If you're not sure what it is, ask your host.
*
* Name this file index.php and place in the directory.
*/
// Define the full path to your folder from root
$path = " /local/home/tournam4/public_html/Downloads/";
// Open the folder
$dir_handle = @opendir($path) or die("Unable to open $path");
// Loop through the files
while ($file = readdir($dir_handle)) {
if($file == "." || $file == ".." || $file == "index.php" )
continue;
echo "<a href="$file\">$file</a><br>";
}
// Close
closedir($dir_handle);
?>
It looks just like the one above.
Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in /home/tournam4/public_html/Downloads/index.php on line 41
Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in /home/tournam4/public_html/Downloads/index.php on line 41
- xxsonyboy4lfexx
- Posts: 315
- Joined: Sat Jan 07, 2006 4:42 pm
- Location: California
17 posts
• Page 2 of 2 • 1, 2
Return to HTML, CSS, and Scripts
Who is online
Users browsing this forum: No registered users and 3 guests