A Digital Age Deserves A Digital Leader

Need to display a directory on a page kinda

Postby c0ldfyr3 » Thu Jan 31, 2008 8:20 pm

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.
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby xxsonyboy4lfexx » Fri Feb 01, 2008 5:21 pm

Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in /home/tournam4/public_html/Downloads/index.php on line 41

????^
Image
PRO Level 8
User avatar
Posts: 315
Joined: Sat Jan 07, 2006 4:42 pm
Location: California

Postby c0ldfyr3 » Sat Feb 02, 2008 10:27 pm

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);

?>
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby c0ldfyr3 » Sat Feb 02, 2008 10:28 pm

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
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);

?>
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby xxsonyboy4lfexx » Sun Feb 03, 2008 3:07 am

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
Image
PRO Level 8
User avatar
Posts: 315
Joined: Sat Jan 07, 2006 4:42 pm
Location: California

Postby c0ldfyr3 » Sun Feb 03, 2008 4:03 am

will you please post the complese source, or pm me with it.
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby xxsonyboy4lfexx » Mon Feb 04, 2008 8:03 pm

Image
PRO Level 8
User avatar
Posts: 315
Joined: Sat Jan 07, 2006 4:42 pm
Location: California

Previous

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 3 guests

cron
cron