mark_kccs Posted March 17, 2007 Share Posted March 17, 2007 Hello My current scenario for this process is a follows: I create a new user and set up the directories with a script. One of the directories is for uploading files and I create an FTP username and password manually in my isp’s control panel. This locks down the directory when the user logins with an FTP client. I have been told that I should be able to set the FTP username and password from the script but despite lots of searching cannot find the answer. Any pointers in the right direction will be much appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/43131-set-ftp-username-and-password/ Share on other sites More sharing options...
Vikas Jayna Posted March 17, 2007 Share Posted March 17, 2007 Check out the ftp functions available in php at http://in2.php.net/manual/en/ref.ftp.php Link to comment https://forums.phpfreaks.com/topic/43131-set-ftp-username-and-password/#findComment-209484 Share on other sites More sharing options...
mark_kccs Posted March 17, 2007 Author Share Posted March 17, 2007 Hi Vikas Thanks for the reply. I did look there but cannot see what I'm looking for as nothing there gives me the option to set the user and pass as far as I can see. any suggestions? Thanks Link to comment https://forums.phpfreaks.com/topic/43131-set-ftp-username-and-password/#findComment-209639 Share on other sites More sharing options...
per1os Posted March 18, 2007 Share Posted March 18, 2007 <?php // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_server, for user $ftp_user_name"; } // upload the file $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo "FTP upload has failed!"; } else { echo "Uploaded $source_file to $ftp_server as $destination_file"; } // close the FTP stream ftp_close($conn_id); ?> As seen on http://us3.php.net/manual/en/ref.ftp.php in the example section. Link to comment https://forums.phpfreaks.com/topic/43131-set-ftp-username-and-password/#findComment-209778 Share on other sites More sharing options...
mark_kccs Posted March 18, 2007 Author Share Posted March 18, 2007 Hi Frost Thanks for the reply. Does this script set a perminant user and pass? It looks like it would be used to logon to a file with these already set. Am I missing something? Thanks Link to comment https://forums.phpfreaks.com/topic/43131-set-ftp-username-and-password/#findComment-209819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.