[PHP] PHP - File Edit
Does anyone know of a simple program that will let me specify a file within a certain directory to load into a textarea field, let me make changes, then export/replace that file with the changed contents? I tried writing one myself in PHP, but I ran into a problem with quotes. If I had tags in in the text area e.g. table width=500 it would mess up the quotes by adding back slashes etc. TIA, -Matt -- Matt Zur [EMAIL PROTECTED] http://www.zurnet.com Need a Web Site??? - Visit... www.zurnet.com 1997 - 2003 - 6th Anniversary!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP - File Edit
On Fri, 6 Jun 2003, Matt Zur wrote: Does anyone know of a simple program that will let me specify a file within a certain directory to load into a textarea field, let me make changes, then export/replace that file with the changed contents? I tried writing one myself in PHP, but I ran into a problem with quotes. If I had tags in in the text area e.g. table width=500 it would mess up the quotes by adding back slashes etc. Strip them backslashes :) http://www.php.net/stripslashes Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP - File Edit
Try this: ?php $test='sth=sth'; $test=htmlentities ($test, ENT_QUOTES); echo input type=textarea value=\$test\; ? Matt Zur [EMAIL PROTECTED] píse v diskusním príspevku news:[EMAIL PROTECTED] Does anyone know of a simple program that will let me specify a file within a certain directory to load into a textarea field, let me make changes, then export/replace that file with the changed contents? I tried writing one myself in PHP, but I ran into a problem with quotes. If I had tags in in the text area e.g. table width=500 it would mess up the quotes by adding back slashes etc. TIA, -Matt -- Matt Zur [EMAIL PROTECTED] http://www.zurnet.com Need a Web Site??? - Visit... www.zurnet.com 1997 - 2003 - 6th Anniversary!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP - File Edit
Maybe this can help : A simple configuration file editor to ease you life in setting up php applications. Reads variables from a given file automatically and displays current value. New value will be written to file after submit. http://examples.weberdev.com/get_example.php3?count=1741 or EditPHP - PHP HTML online file editor with encrypted password authentication http://examples.weberdev.com/get_example.php3?count=1496 Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -Original Message- From: Matt Zur [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2003 8:17 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP - File Edit Does anyone know of a simple program that will let me specify a file within a certain directory to load into a textarea field, let me make changes, then export/replace that file with the changed contents? I tried writing one myself in PHP, but I ran into a problem with quotes. If I had tags in in the text area e.g. table width=500 it would mess up the quotes by adding back slashes etc. TIA, -Matt -- Matt Zur [EMAIL PROTECTED] http://www.zurnet.com Need a Web Site??? - Visit... www.zurnet.com 1997 - 2003 - 6th Anniversary!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Edit
Hello, I want to be able to edit part of a file. via a text box using php how do i read a file and get the part i want to read and edit it and then write it back to that file here is an example: . case $1 in start) 100.123.456.789 321.654.987.231 123.45.456.789 123.456.789.12 ;; In this example I want to be able to be able to pull the ipaddresses out and edit them and add a new one on to the end and then write the data back to the file. Thanks in advance Randy
Re: [PHP] File Edit
You read the entire file into memory (an array using file() perhaps) and then edit it in memory and write the entire new file back out. -Rasmus On Mon, 25 Mar 2002, Randy Johnson wrote: Hello, I want to be able to edit part of a file. via a text box using php how do i read a file and get the part i want to read and edit it and then write it back to that file here is an example: . case $1 in start) 100.123.456.789 321.654.987.231 123.45.456.789 123.456.789.12 ;; In this example I want to be able to be able to pull the ipaddresses out and edit them and add a new one on to the end and then write the data back to the file. Thanks in advance Randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Edit
How do I know what part of it to read in the array? - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Randy Johnson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, March 25, 2002 9:03 PM Subject: Re: [PHP] File Edit You read the entire file into memory (an array using file() perhaps) and then edit it in memory and write the entire new file back out. -Rasmus On Mon, 25 Mar 2002, Randy Johnson wrote: Hello, I want to be able to edit part of a file. via a text box using php how do i read a file and get the part i want to read and edit it and then write it back to that file here is an example: . case $1 in start) 100.123.456.789 321.654.987.231 123.45.456.789 123.456.789.12 ;; In this example I want to be able to be able to pull the ipaddresses out and edit them and add a new one on to the end and then write the data back to the file. Thanks in advance Randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Edit
You read all of it On Mon, 25 Mar 2002, Randy Johnson wrote: How do I know what part of it to read in the array? - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Randy Johnson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, March 25, 2002 9:03 PM Subject: Re: [PHP] File Edit You read the entire file into memory (an array using file() perhaps) and then edit it in memory and write the entire new file back out. -Rasmus On Mon, 25 Mar 2002, Randy Johnson wrote: Hello, I want to be able to edit part of a file. via a text box using php how do i read a file and get the part i want to read and edit it and then write it back to that file here is an example: . case $1 in start) 100.123.456.789 321.654.987.231 123.45.456.789 123.456.789.12 ;; In this example I want to be able to be able to pull the ipaddresses out and edit them and add a new one on to the end and then write the data back to the file. Thanks in advance Randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Edit
ok i read all the file into an array, now do i search each line in the array . based on my example i do not know how to proceed after reading it into the array case $1 in start) 100.123.456.789 321.654.987.231 123.45.456.789 123.456.789.12 ;; - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Randy Johnson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, March 25, 2002 9:11 PM Subject: Re: [PHP] File Edit You read all of it On Mon, 25 Mar 2002, Randy Johnson wrote: How do I know what part of it to read in the array? - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Randy Johnson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, March 25, 2002 9:03 PM Subject: Re: [PHP] File Edit You read the entire file into memory (an array using file() perhaps) and then edit it in memory and write the entire new file back out. -Rasmus On Mon, 25 Mar 2002, Randy Johnson wrote: Hello, I want to be able to edit part of a file. via a text box using php how do i read a file and get the part i want to read and edit it and then write it back to that file here is an example: . case $1 in start) 100.123.456.789 321.654.987.231 123.45.456.789 123.456.789.12 ;; In this example I want to be able to be able to pull the ipaddresses out and edit them and add a new one on to the end and then write the data back to the file. Thanks in advance Randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Edit
On Tuesday 26 March 2002 10:41, Randy Johnson wrote: ok i read all the file into an array, now do i search each line in the array . Yes. Based on the fragment of file that you've given, here's some psuedo-code. initialise 3 arrays, $top, $middle, $bottom; $found_middle = 0; $found_bottom; for each $line in input array { if ($line not digit) { if (!$found_middle) { $top[] = $line; } else { $bottom[] = $line; }} else { $found_middle = 1; $middle[] = $line; } } // Now you have 3 arrays, // $top contains all lines before the IPs, // $middle contains lines with IPs, // $bottom contains all lines after the IPs Do what you need to edit $middle then write $top, $middle, $bottom out to the file. based on my example i do not know how to proceed after reading it into the array case $1 in start) 100.123.456.789 321.654.987.231 123.45.456.789 123.456.789.12 ;; - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Randy Johnson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, March 25, 2002 9:11 PM Subject: Re: [PHP] File Edit You read all of it On Mon, 25 Mar 2002, Randy Johnson wrote: How do I know what part of it to read in the array? - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Randy Johnson [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, March 25, 2002 9:03 PM Subject: Re: [PHP] File Edit You read the entire file into memory (an array using file() perhaps) and then edit it in memory and write the entire new file back out. -Rasmus On Mon, 25 Mar 2002, Randy Johnson wrote: Hello, I want to be able to edit part of a file. via a text box using php how do i read a file and get the part i want to read and edit it and then write it back to that file here is an example: . case $1 in start) 100.123.456.789 321.654.987.231 123.45.456.789 123.456.789.12 ;; In this example I want to be able to be able to pull the ipaddresses out and edit them and add a new one on to the end and then write the data back to the file. Thanks in advance Randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php