We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Above Public_Html; arghhhh
Topic Started: Nov 10 2005, 03:00 PM (234 Views)
Tsurayaki
Member
[ *  *  *  * ]
Ok, so i have a file in a directory that is above the public_html directory on my hosting account and i want to access the file. It is a .html file so i want to display it. Now, is there anyway to do this, i have been searching google for hours :'(

Thanks :)
Offline Profile Quote Post Goto Top
 
Oblivion.
Member Avatar
*waves*
[ *  *  *  *  *  *  *  * ]
Access it from your browser, or FTP cleint?
Offline Profile Quote Post Goto Top
 
Tsurayaki
Member
[ *  *  *  * ]
you cant access anything above public_html in a URL. I want a script to include the file.
Offline Profile Quote Post Goto Top
 
Tadamichi
Member Avatar
Member
[ *  *  *  * ]
Tsurayaki
Nov 10 2005, 07:28 PM
you cant access anything above public_html in a URL. I want a script to include the file.

I am pretty sure you can.

Just go to www.yourdomain.com/folder

If you want to include a file you can use PHP's include function.
Code:
 
<?php include 'path/to/file.php'; ?>
Offline Profile Quote Post Goto Top
 
Oblivion.
Member Avatar
*waves*
[ *  *  *  *  *  *  *  * ]
Tadamichi
Nov 10 2005, 08:14 PM
Tsurayaki
Nov 10 2005, 07:28 PM
you cant access anything above public_html in a URL. I want a script to include the file.

I am pretty sure you can.

Just go to www.yourdomain.com/folder

If you want to include a file you can use PHP's include function.
Code:
 
<?php include 'path/to/file.php'; ?>

public_html in FTP... is where your files for www.yourdomain.com are saved ;).

You can easily use a PHP include to do what you want ;) Even though it would be easier for you to just move the file unless there's a reason for it being there.
Offline Profile Quote Post Goto Top
 
Tadamichi
Member Avatar
Member
[ *  *  *  * ]
Opps. I guess its because my server doesn't have public_html :P

Ignore the first comment then...
Offline Profile Quote Post Goto Top
 
Tsurayaki
Member
[ *  *  *  * ]
yea, it s a script that create an email address which you someone just brought. So i have a html form which the action needs to be the script which is above public_html. i cant access it through www.url.com because that starts in public_html. I have uploaded the file using ftp into a folder named emails above public_html

Any suggestions?
Cheers
Offline Profile Quote Post Goto Top
 
Kazuki-ZNR
...
Just to clear up some confusion, when he says above public_html he means outside that folder.
Offline Profile Quote Post Goto Top
 
Surferdude
Critic
[ *  *  *  *  *  *  * ]
No, that is not possible. Your Document Root is public_html
Offline Profile Quote Post Goto Top
 
Tsurayaki
Member
[ *  *  *  * ]
It is possible. Theres a php script in which it uses fopen to open a file above public_html. But i cant figure out how to use that to open a file :(
Offline Profile Quote Post Goto Top
 
scizor
w00t member titles
[ *  *  *  *  * ]
Move it into public_html or ask your host.
Offline Profile Quote Post Goto Top
 
Surferdude
Critic
[ *  *  *  *  *  *  * ]
Tsurayaki
Nov 11 2005, 04:55 PM
It is possible. Theres a php script in which it uses fopen to open a file above public_html. But i cant figure out how to use that to open a file :(

Well, if you host has PhpSuExec turned on, then you wont be able to fopen() anything outside of your Doc Root. Heres a script to try it, if your using cPanel and the file you want to get is a text file:

Code:
 
<?php

$username = ""; // Change this to your cPanel username. i.e: $username = "foobar";
$filename = ""; // Change this to the name of the textfile you want to get that is not in public_html. i.e: $filename = "foobarbaz.txt";

if ($username == "" OR $filename == "")
{
echo 'This script will not run untill you edit the $username and $filename values';
exit;
}

$fp = fopen("/home/$username/$filename")or die("Either the file does not exist, or your host has disabled fopen.");

while (!feof($fp))
{
$buffer = fgets($fp,4096);
echo $buffer;
}
?>


Be sure to edit $username and $filename or else the script wont work.

Offline Profile Quote Post Goto Top
 
Tsurayaki
Member
[ *  *  *  * ]
The file i need is a php file. I guess there is no real way to get to it then. I have secured the file another way now anyway. Thanks for everyone's help"
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply