Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> I Need Help With File Edit In Php, with ftp
waterfoul
post Oct 29 2005, 03:19 AM
Post #1


Newbie [Level 2]
**

Group: Members
Posts: 32
Joined: 25-October 05
Member No.: 13,370



Currently i have
CODE

<?php
if($_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 login
if (@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 connection
ftp_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?
Go to the top of the page
 
+Quote Post
wow
post Oct 29 2005, 03:35 AM
Post #2


Member [Level 1]
****

Group: Members
Posts: 58
Joined: 22-October 05
Member No.: 13,216



QUOTE(waterfoul @ Oct 28 2005, 09:19 PM)
Currently i have
CODE

<?php
if($_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 login
if (@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 connection
ftp_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?
*


I dont know what file you need to get, but you can edit your php file with notepad.
Go to the top of the page
 
+Quote Post
waterfoul
post Oct 29 2005, 03:44 AM
Post #3


Newbie [Level 2]
**

Group: Members
Posts: 32
Joined: 25-October 05
Member No.: 13,370



QUOTE(wow @ Oct 28 2005, 09:35 PM)
I dont know what file you need to get, but you can edit your php file with notepad.
*


i want to have a user fill out a form and it edits a vars.php file in places in that file
Go to the top of the page
 
+Quote Post
mama_soap
post Oct 29 2005, 03:49 AM
Post #4


Super Member
*********

Group: Members
Posts: 282
Joined: 30-May 05
From: Bangalore
Member No.: 7,686



I am not sure if this will help, but I would suggest looking up the official guide for ideas. You can also try looking up this tutorial .

Cheers smile.gif
Go to the top of the page
 
+Quote Post
waterfoul
post Oct 29 2005, 03:57 AM
Post #5


Newbie [Level 2]
**

Group: Members
Posts: 32
Joined: 25-October 05
Member No.: 13,370



QUOTE(mama_soap @ Oct 28 2005, 09:49 PM)
I am not sure if this will help, but I would suggest looking up the official guide for ideas. You can also try looking up this tutorial .

Cheers smile.gif
*


only help it did was going to the root dir
Go to the top of the page
 
+Quote Post
Spectre
post Oct 29 2005, 06:21 AM
Post #6


Privileged Member
*********

Group: Members
Posts: 874
Joined: 30-July 04
Member No.: 246



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.
Go to the top of the page
 
+Quote Post
Regain
post Nov 20 2006, 11:10 PM
Post #7


Newbie [Level 2]
**

Group: Members
Posts: 25
Joined: 20-November 06
Member No.: 33,763



well chnage the parts u hav 2 change basically such as "FTP Username"
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Getting List Of Directories And Files Using Php(6)
  2. Script: Php Jukebox(4)
  3. Alternative To File()?(4)
  4. Image Upload And File Size(2)
  5. Memberlist Advance Edit(0)
  6. Reading 16 Bit Wav File(0)
  7. Include File.php?id=something(13)
  8. Php File Problem(5)
  9. Phpnuke Add Download Section(2)
  10. Logging Dowload Files From Your Server Onto A Html File(1)
  11. File String Delete?(2)
  12. Php Writes Into Txt File(8)
  13. File In Database(1)
  14. File Format Unknown! (wap)(6)
  15. Display Random File In A Directory(9)
  1. Help Needed With Directory/file Listing Code Infinite Loop(5)
  2. Help Php: How To Load String From Text File (solved)(9)
  3. Php Help Needed Including File In A Page.(2)
  4. Edit .txt File In Ftp Via Webpage(2)
  5. [php]simple Flat File Text Manipulator(3)
  6. <?php ?> Unique Visitors Script(2)
  7. File Upload(1)
  8. No File Extension(3)
  9. Php And Flash Image Gallery(5)
  10. File Checker-how To Check File Whith Html Through Html?(2)
  11. Updating Php File Through A Web Form(5)
  12. Need Some Help In File Browser(8)
  13. Php Configuration File(16)


 



-