p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Beginning PHP (http://p2p.wrox.com/forumdisplay.php?f=95)
-   -   File Access (http://p2p.wrox.com/showthread.php?t=752)

natmaster June 19th, 2003 03:59 PM

File Access
 
I want to read some files for some dynamic pages from a folder on my server that is not set to be readable by the public; i can't just change the attributes because it is bought server space and so some folders i cannot change. I can access these folders if i login as my account so i was wondering if there were some way i could have the php script log me in so i can read from those files.

I tried:
$ftp_server = "???";
$ftp_user = "???";
$ftp_pass = "???";

// set up a connection or die
$conn_id = ftp_connect("$ftp_server",21) or die("Couldn't connect to $ftp_server");

// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
    echo "Connected as $ftp_user@$ftp_server\n";
    exit();
} else {
    echo "Couldn't connect as $ftp_user\n";
    exit();
}
//opens file for reading down here

i thought that might solve my problem, but i just got this error:
Fatal error: Call to undefined function: ftp_connect() in /usr/data/httpd/users/mordecai/immortal/finishLogin.php on line 18
(line 18 is the line i use ftp_connect())

----------------------------
Oh happyland!

Moharo June 20th, 2003 11:51 AM

this might be due to the fact that your hosting company disabled ftp_connect() function :((((

the genuine genius

natmaster June 23rd, 2003 03:20 PM

i got it to work now, just using an ftp login as part of the filename (ftp://username:password@domain/filelocation)

----------------------------
Oh happyland!


All times are GMT -4. The time now is 07:03 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.