Php File Help
- Inglor
-
Inglor
- Member since: Jan. 26, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (10,869)
- Block
-
- Forum Stats
- Member
- Level 17
- Blank Slate
Hello, I have a site I'm building for a friend, and I want him to be able to add pages to his site, I already built him a parser (for [b] [u] [img] [url] [inr] and so on), now I want to be able to create new files on the directory and I'm NOT WILLING to 1)use databases (like I said, on the dir) 2)make the directory public
so what I need to know is how to connect to the dir with an FTP account, I never did php+ftp :P always sql, please help
I need to
1)ftp_connect (I know the command, I know nothing more) and create a file
2)open that file with fopen and be able to update it
Thanks for your help ng :)
Inglor
- Craige
-
Craige
- Member since: Jul. 17, 2004
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
This may sound ignorant, but try PHP.net for the function details.
// MustyWindows - Jump Through The Windows
// AmpFusion - Where Underground Becomes Mainstream
Neo Enterprise Technologies Coming soon.
- Inglor
-
Inglor
- Member since: Jan. 26, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (10,869)
- Block
-
- Forum Stats
- Member
- Level 17
- Blank Slate
no shit :P
Yea, I tried that first , they only explain ftp_connect and after you do that, they reffer you nowhere :P
- LordAba
-
LordAba
- Member since: Nov. 2, 2000
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
At 6/24/05 10:55 AM, Inglor wrote: Yea, I tried that first , they only explain ftp_connect and after you do that, they reffer you nowhere :P
Yeah... did you even look at the php.net page?
http://us2.php.net/ftp_connect
It lists all the relevent ftp functions on the list on the left side of the screen....
pwned
What may man within him hide, though angel on the outward side.
- Craige
-
Craige
- Member since: Jul. 17, 2004
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
You just looked up ftp_connect, search for ftp in general. they list the functions at http://ca3.php.net/manual/en/ref.ftp.php and show you how to use them a bit. (see each function details for more info.)
// MustyWindows - Jump Through The Windows
// AmpFusion - Where Underground Becomes Mainstream
Neo Enterprise Technologies Coming soon.
- WhiteBlackPerson
-
WhiteBlackPerson
- Member since: Aug. 4, 2001
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
PHP's ftp functions are for pussies.
Real men use fsockopen('localhost',21) and then send raw ftp commands to connect.
Search google for "raw ftp commands". Once you use the STOR filename command, pass the PORT or PASV command to open a new socket, then you just send the filestream through that socket.
Or you can use regular copy(targ,dest) and just put a .htaccess in the uploads directory to block file viewing:
order allow, deny
deny from all
allow from localhost
(or try switching deny,allow , i never remember the order)
- Inglor
-
Inglor
- Member since: Jan. 26, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (10,869)
- Block
-
- Forum Stats
- Member
- Level 17
- Blank Slate
At 6/24/05 11:02 AM, Lord_Aba wrote:
pwned
well, I'm faking my location, so it directed me to static.php.net page, which DOESN'T have that list! unpwned :P
- Inglor
-
Inglor
- Member since: Jan. 26, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (10,869)
- Block
-
- Forum Stats
- Member
- Level 17
- Blank Slate
problam:
Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/leyada3/public_html/pat2/content/cadmin.php on line 21
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/leyada3/public_html/pat2/content/cadmin.php on line 22
boo
code:
conn_id=ftp_connect("ftp://www.leyada.3qhost.com/public_html/pat2/content/"
,21);
$login_result = ftp_login($conn_id, "leyada3", "mypass");
- liljim
-
liljim
- Member since: Dec. 16, 1999
- Offline.
-
- Send Private Message
- Browse All Posts (11,644)
- Block
-
- Forum Stats
- Staff
- Level 28
- Blank Slate
At 6/24/05 11:28 AM, Inglor wrote: problam:
/public_html/pat2/content/ doesn't exist. At least that's the error you get if you try through a browser.
- Inglor
-
Inglor
- Member since: Jan. 26, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (10,869)
- Block
-
- Forum Stats
- Member
- Level 17
- Blank Slate
- Pilot-Doofy
-
Pilot-Doofy
- Member since: Sep. 13, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (12,142)
- Block
-
- Forum Stats
- Member
- Level 37
- Musician
At 6/24/05 11:06 AM, WhiteBlackPerson wrote: PHP's ftp functions are for pussies.
*sigh*
I'm so sick of hearing that once something becomes easier it makes it "less leet". I mean come on, no one likes to do more work than they have to. Some people...
- Sar-Casm
-
Sar-Casm
- Member since: Dec. 13, 2002
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 6/24/05 12:15 PM, Pilot-Doofy wrote:At 6/24/05 11:06 AM, WhiteBlackPerson wrote: PHP's ftp functions are for pussies.*sigh*
I'm so sick of hearing that once something becomes easier it makes it "less leet". I mean come on, no one likes to do more work than they have to. Some people...
Indeed. PHP is designed (well, if you could call it that) to be an ad hoc language; get the job done in a quick and dirty fashion. Just see what the original developer Rasmus Lerdorf thinks of it.

