
December 11th, 2003, 11:32 PM
|
|
oodles and oodles of O's
|
|
Join Date: Aug 2003
Location: Chicago
Posts: 34
Time spent in forums: 3 m 58 sec
Reputation Power: 5
|
|
|
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
|