View Single Post
Old 2006-07-25, 03:24 AM   #3
Beaver Bob
Porn Blog Addict
 
Beaver Bob's Avatar
 
Join Date: Oct 2005
Location: Las Vegas, Nevada
Posts: 715
Send a message via ICQ to Beaver Bob
Thumbs up

useless, I've always found it easier to have PHP use FTP. I've never had much luck any other way. If FTP extensions aren't installed with the version of PHP on your server, have your system admin do that first.

This function can be used to make a directory, the values you need to replace in this are $server, $user, and $pass. The first argument needs to be the absolute path of where you want to create your directory, the second is the name of the new directory.

PHP Code:
// create directory through FTP connection
function FtpMkdir($path$newDir) {
  
       
$server='255.255.255.255'// ftp server
       
$connection ftp_connect($server); // connection
 
       // login to ftp server
       
$user "USERNAME";
       
$pass "PASSWORD";
       
$result ftp_login($connection$user$pass);

   
// 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($connection); // close connection
   
}


Beaver Bob is offline   Reply With Quote