FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old December 11th, 2003, 11:32 PM
cephlon cephlon is offline
oodles and oodles of O's
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Chicago
Posts: 34 cephlon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 58 sec
Reputation Power: 5
Send a message via Yahoo to cephlon
ftp_login with variables is a problem

Here is the code
PHP Code:
function FtpMkdir($path$newDir) {

       
$server='eltonwilson.com'// ftp server
       
$connection ftp_connect($server); // connection


       // login to ftp server
       
$result ftp_login($connection$ftp_username$ftp_password);

   
// check if connection was made
     
if ((!$connection) || (!$result)) {
       return 
false;
       exit();
       } else {
         
//ftp_chdir($connection, $path); // go to destination dir
       
if(ftp_mkdir($connection,$newDir)) { // create directory
           
return $newDir;
       } else {
           return 
false;
       }
   
ftp_close($conn_id); // close connection
   
}




This function works fine if in ftp_login i use actual names instead of variables. ie:
PHP Code:
 ftp_login($connection"joe@eltonwilson.com""password"); 


But it doesn't work if the variables are used, which I need to do. The $ftp_username and $ftp_password are assigned from MySql. Does the fact that the user name contains an @ sign have anything to do with it?

The error message I get when using the variables is
Warning: ftp_mkdir(): Sorry, anonymous users are not allowed to create directories in /home/elton247/public_html/excel/email_event_information.php on line 178

Reply With Quote
  #2  
Old December 11th, 2003, 11:41 PM
Nycto's Avatar
Nycto Nycto is offline
coding with style
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Mar 2003
Location: Washington
Posts: 1,210 Nycto User rank is Sergeant Major (2000 - 5000 Reputation Level)Nycto User rank is Sergeant Major (2000 - 5000 Reputation Level)Nycto User rank is Sergeant Major (2000 - 5000 Reputation Level)Nycto User rank is Sergeant Major (2000 - 5000 Reputation Level)Nycto User rank is Sergeant Major (2000 - 5000 Reputation Level)Nycto User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 21 h 54 m 20 sec
Reputation Power: 47
Send a message via ICQ to Nycto Send a message via AIM to Nycto
$ftp_username and $ftp_password may be selected from the database at some point, but they are not defined anywhere in the function, thus they are Null when you are connecting.

You need to either pass them when you call the function or define them as Global.
__________________
- Nycto

Reply With Quote
  #3  
Old December 12th, 2003, 11:56 AM
cephlon cephlon is offline
oodles and oodles of O's
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Chicago
Posts: 34 cephlon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 58 sec
Reputation Power: 5
Send a message via Yahoo to cephlon
Ug, of course. Thanks. Works perfect now.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > ftp_login with variables is a problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway