Jump to content
xisto Community
waterfoul

I Need Help With File Edit In Php with ftp

Recommended Posts

Currently i have

<?phpif($_POST['user']=="" or $_POST['pass']=="" or $_POST['host']=="" or $_POST['root']=="" or !isset($_POST['run'])){  print('<form method=post name=form>');  print('FTP username <input type=\'text\' name=user value=""><br>');  print('FTP password <input type=\'password\' name=pass value=""><br>');  print('FTP Host <input type=\'text\' name=host value=""><br>');  print('FTP Root Directory <input type=\'text\' name=root value=""><br>');  print('<input type=\'hidden\' name=run value="1">');  print('<input type=\'submit\'>');}else{$ftp_server = $_POST['host'];$ftp_user = $_POST['user'];$ftp_pass = $_POST['pass'];$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server please refresh and do not click retry");// try to loginif (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {   echo "Connected as $ftp_user@$ftp_server\n";} else {   echo "Couldn't connect as $ftp_user\n please refresh and do not click retry";}// close the connectionftp_close($conn_id);  }?>
currently it has a form and after you fill out the form it logs into the ftp with the user pass and server vars. now i need to know how to get a certian file and edit certian lines of it. any ideas?

Share this post


Link to post
Share on other sites

Currently i have

<?phpif($_POST['user']=="" or $_POST['pass']=="" or $_POST['host']=="" or $_POST['root']=="" or !isset($_POST['run'])){ ?print('<form method=post name=form>'); ?print('FTP username <input type=\'text\' name=user value=""><br>'); ?print('FTP password <input type=\'password\' name=pass value=""><br>'); ?print('FTP Host <input type=\'text\' name=host value=""><br>'); ?print('FTP Root Directory <input type=\'text\' name=root value=""><br>'); ?print('<input type=\'hidden\' name=run value="1">'); ?print('<input type=\'submit\'>');}else{$ftp_server = $_POST['host'];$ftp_user = $_POST['user'];$ftp_pass = $_POST['pass'];$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server please refresh and do not click retry");// try to loginif (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { ? echo "Connected as $ftp_user@$ftp_server\n";} else { ? echo "Couldn't connect as $ftp_user\n please refresh and do not click retry";}// close the connectionftp_close($conn_id); ?}?>
currently it has a form and after you fill out the form it logs into the ftp with the user pass and server vars. now i need to know how to get a certian file and edit certian lines of it. any ideas?

199248[/snapback]

I dont know what file you need to get, but you can edit your php file with notepad.

Share this post


Link to post
Share on other sites

I would suggest looking up the reference provided. It explains everything you need to know about using the FTP protocol with PHP. There isn't really anything anyone else can tell you that isn't already contained within the official manual, so try reading about some of the functions and features.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.